Hello,
im not sure if i misunderstood something or if i chose the wrong implementation for my use case.
I will try to explain my problem. I have configured a SPA in Auth0. Users log in and get back an access token which the SPA uses to call an API on behalf of the user. The API is also configured in Auth0 and implemented by me. I enabled RBAC in the Auth0 dashboard´s API and configured a role with two permissions which i assigned to the test-user. If the test-user logs in to the SPA with ‘aud’ set to the identifier of the API he gets back a token which looks something like this:
{
"iss": "***",
"sub": "test-user",
"aud": [
"https://identifier/of/my/api",
"https://***/userinfo"
],
"iat": ***,
"exp": ***,
"azp": "***",
"scope": "openid profile email",
"permissions": [
"use:privateroute1",
"use:privateroute2"
]
}
So far so good i guess. But now i also configured a Machine to Machine Application to access the same API. The M2M application has access to the same two permissions the test-user has access to.
If the M2M App requests a token to access the API the token looks something like this:
{
"iss": "***",
"sub": "***",
"aud": "identifier/of/my/api",
"iat": ***,
"exp": ***,
"azp": "***",
"scope": "use:privateroute1 use:privateroute2",
"gty": "client-credentials"
}
I dont understand why the permissions “use:privateroute1 use:privateroute2” are displayed differently in the two access tokens. I find this very inconvenient because it is a hassle to validate the different tokens in the backend API. And i dont think this way is the “best practice” way.
My future plan is to add many APIs behind a single logical API and some Machine to Machine Applications all connected to each other with an even larger size of Scopes/Permissions (still confused which term to use ) based on Groups/Roles/Users. What would be the best way to implement such a use case to have a global access token validation system every backend API can implement easily?
Thank you very much in advance
Robin