I am using angular-oauth2-oidc lib for authentication. After successful authentication, I want to fetch roles/ other properties from the access token. But as of now, there is no direct method which can parse token and gives its internal attributes. Is there any way via which can get all the roles or other attributes of the token? Any help would be much appreciated.
Asked
Active
Viewed 2,267 times
1 Answers
0
Depends on where you store roles. Often, the access token is just an opaque string; at least, to the library it is opaque. You might know it's JWT, if I recall correctly you'd need to parse that yourself using said library.
What does work is if it's (also) part of the identity. Calling this.oauthService.getIdentityClaims()
should give you an object with wall the claims by key, for example roles could be part of it, depending on your server setup.

Jeroen
- 60,696
- 40
- 206
- 339