Hi,
thanks for the article. I still find one thing pretty confusing (and I hope it hasn’t been addressed earlier, I tried to scan all posts in this thread
I keep getting confused what scopes in the access token express. You wrote in the last diagram, “Access Token DOs: check if the client is allowed to access something”
Isn’t that actually wrong?
Shouldn’t it rather be: “First, check if the scope of the access token actually allows access to that resource, and only if it does, you need to do the real check if the user on whose behalf you are accessing the resource actually has the right”?
Otherwise, users could let the auth server issue tokens that allow access to any data of any user, but that shouldn’t let the resource server return this data, right?
Like, if in the access token only has the scope “email:read”, then accessing a resource to write e-mails would already fail because the scope “email:write” is not included, but trying to read an e-mail would not fail immediately because the scope is right, but then you would still have to figure out (without the token) if the user actually has access to that specific mail (e.g. is this mail one of theirs or does it belong to a different user, or has the right to read their own mails been revoked from this account for whatever reason)
And this is where I’m getting to an architectural question, if I manage roles in auth0, I would like them to be included in the access token so I can make those decisions without doing other API calls, would it mean that I have a token that has both a roles section (that I can trust to be valid) and a scope section that limits which permissions attached to the roles I can use?
So I would first read out the scopes to see if the call is valid at all, and then rely on the roles in the token to decide if the permission is there or not?