Obtain Application roles from idToken
See original GitHub issueI’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[x] Documentation issue or request
[ ] Other... Please describe:
Browser:
- Chrome version 75
- Firefox version XX
- IE version XX
- Edge version 76
- Safari version XX
Library version
Library version: 1.0.2
Current behavior
Once SSO is successful I know who the user is but not which roles he has assigned.
Expected behavior
Once the SSO is successful I would expect to be able to get user roles from the idToken in order to restrict parts of the applications or actions to admin users only.
Minimal reproduction of the problem with instructions
I created an example in codesandbox.io: https://codesandbox.io/s/vue-template-evqjg The code is also checked in at https://github.com/RecuencoJones/Vue-Azure-SSO-example
Previous steps to setup Azure AD
- Create an Azure AD directory.
- Create an App Registration on Azure AD.
- On Advanced settings, check both
Access tokens
andID tokens
for Implicit grant. - Edit following manifest fields:
"accessTokenAcceptedVersion": 2, "appRoles": [ { "allowedMemberTypes": [ "User", "Application" ], "description": "Admin user for the application", "displayName": "Administrator", "id": "ccf2cb33-c1d2-4101-a1e8-b88e1d3806b2", "isEnabled": true, "lang": null, "origin": "Application", "value": "AdminUser" }, { "allowedMemberTypes": [ "User", "Application" ], "description": "Common user for the application", "displayName": "User", "id": "2ca47286-7be9-47b8-9c76-1369b3021506", "isEnabled": true, "lang": null, "origin": "Application", "value": "RegularUser" } ], "groupMembershipClaims": "All", "oauth2AllowIdTokenImplicitFlow": true, "oauth2AllowImplicitFlow": true, "signInAudience": "AzureADandPersonalMicrosoftAccount",
- Create an Enterprise Application bound to previous App Registration
- Add your user to the Enterprise Application and assign Admin role.
Test:
- Fork the sandbox https://codesandbox.io/s/vue-template-evqjg
- Update App registration Redirect URIs to add
https://<sandbox-id>.codesandbox.io
asWeb
type. - Copy Application Client ID from App registration and replace the value of
clientId
inconfig/auth.js
with it. - Open the live preview in a new tab (codesandbox does not allow redirect within their embedded preview).
- Attempt to SSO.
- Check developer console for Account object and browse idToken entry.
- No claims related to roles can be found.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Add app roles and get them from a token - Microsoft Entra
Learn how to add app roles to an application registered in Azure Active Directory. Assign users and groups to these roles, and receive...
Read more >How to add Roles and Permissions to the ID Token using ...
Yes, it's possible to retrieve the user's Roles and/or Permissions and append them to either the ID Token or Access Token.
Read more >How to add roles claim in access_token , currently it is coming ...
I am assigning this role StoreGroupManager to Users. Now when I follow Authorization code flow with PKCE and obtain the id_token , refresh...
Read more >Get an ID token | Authentication - Google Cloud
Generate an ID token using an external identity provider · Identify or create a service account to provide the IAM roles required to...
Read more >Customize tokens returned from Okta with a Groups claim
For an Okta Org Authorization Server, you can only create an ID token with a Groups ... Obtain the following values from your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
On another hand (maybe should create another issue for this one?) once the
auth.loginRedirect()
returns with success I’m able to accessauth.getAccount().idToken
– decoded already.Would it be possible to also add the property
rawIdToken
to it without having to useauth.acquireTokenSilent()
and/orauth.acquireTokenRedirect()
?Closing this. Please open a new issue if there are further questions.