I’m trying to use scopes for an application I’m working on. I’d like to use it to give granular access to our users. I want to be able to get all the scopes the user has related to our application. To give context of the application I work on, we use Okta to authentication and authorization. Users are required to log in to use anything on the application and our APIs verify the OKTA JWT on every request. Currently, we check users’ groups to give access to features of the frontend and API but we’d like to use scopes for more granular access. We use @okta/okta-auth-js on our frontend and @okta/jwt-verifier in our API.
For example, I’ve created an Authorization Server with Scopes, and Policies; Scope A is assigned to Policy A, Scope B is assigned to Policy B and Scope C is assigned to Policy C. A user is assigned to Policy A and C; when they log in I want to know they have Scopes A and C.
When I setup the example above, I use the Token Preview feature to see what I would get if I requested Scope A and C for the user and the result is the user is the error Policy evaluation failed for this request, please check the policy configurations.. However, when I request only Scope A , it’ll be successful and it’ll also succeed when I request only Scope C. I expected when I requested Scope A and C for the user that it would be successful. Ideally, I’d like to request all the scopes and only be given a JWT with the scopes the user has access to.
Am I trying to use scopes incorrectly? Whats the best way to do what I’m trying to accomplish?