I have an API with many different permissions associated with it. Additionally, I have several user roles created that combine multiple permissions into meaningful groups. And, by extension, users have roles assigned to them based on the access they should need for our app.
I have RBAC enabled on my API and I am able to get the
permissions claim added to the token, however, it does not include permissions that are included in the role assigned to the user. I assumed that any permissions granted to the user through a role would be added here, but that’s not the case.
How can I add these permissions from the user’s role(s) to the access token so that they are available in my SPA?
Thanks in advance!
Thanks for reaching out to the Auth0 Community!
After my investigation, I can confirm that you have correctly configured your API with RBAC and enabled the Add Permissions in the Access Token toggle. I also found that your users were correctly assigned to Permissions.
Now, when I try to reproduce the issue on my side, I did not find the same observations. I managed to get the permissions claim with the assigned permissions added to the access token every time by starting the request with something like the following:
Given that, could you please capture a HAR file of the authentication events and DM it to me to investigate further?
And if possible, could you please create a test user for me and DM me the credentials to test the authentication flow of your application?
Hey @rueben.tiow, thank you for looking into this for me. I’m just seeing your reply and I am going to test this in Postman and see if I get different results. I’d be happy to DM you with a HAR file also. Additionally, I don’t think I mentioned that I’m also using the React SDK client-side and I’m retrieving the access token silently through the
getAccessTokenSilently method. It could be that I have something not configured correctly in my provider. I’ll test a couple more things and post an update here soon.
Also, the Auth0Provider is configured like this in my application:
scope="openid profile email"
Hey @rueben.tiow, you’ll have to be patient with me because I am by no means an OAuth or Auth0 expert. I attempted the request you created above in Postman and it returned the universal login page and I’m not sure how to go from that to an access token (at least not in Postman). I’m sure that’s me doing something wrong but I’m not sure what I’m doing incorrectly. Or maybe that’s normal? Perhaps I’m not supposed to be able to perform the flow in Postman. If that’s the case, where should I perform this request from?
If you could provide some more instruction on how exactly to set this up it would be greatly appreciated.
In the meantime, here is a sample of the token data I have access to in my SPA:
"scope": "openid profile email",
Well this is getting immortalized here. If you see the permissions claim but don’t see any permissions inside the claim, make sure your role has permissions in it
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.