the token format is TokenDriver specific and should be only accessed via the token driver. Thus here you should use something like:
```python
username = identity.token_driver().username(token)
```