I am running automated test of my code against my developer Okta account.
I use a script to setup an app of type service with JWT authentication.
I have assigned Okta API scopes okta.groups.read and okta.users.read and uploaded the public PEM key. I can see all this in the Web UI.
When I run my code the JWT token authentication works just fine, but then I try to lookup the groups of a userID in the mgmt API with the JWT token and I get an error:
URL: f"{org.rstrip(‘/’)}/api/v1/users/{lst[0].get(‘id’)}/groups"
Error: AssertionError: Groups API failed: 403 {“errorCode”:“E0000006”,“errorSummary”:“You do not have permission to perform the requested action”,“errorLink”:“E0000006”,“errorId”:“oaefb16eVUrSAmPcRMaqO76AQ”,“errorCauses”:}
I checked the logs in Okta, but I don`t see anything logged about this error.
Using the old method with SWSS API key it works, but this is way too permissive as it cannot properly restricted to read only or certain scopes.
Am I missing anything here? What is the purpose of a service app if the JWT token from that app cannot be used against the mgmt API? Or do I need to assign a policy to the app to make this work, besides the scope granted?
