Our use case involves managing users in our Okta domain via the Users API.
We are developing this with Authorization Code Flow. The frontend passes the Jwt to our Spring Boot app, and this latter will make the request to the Users API with the Jwt token in the header.
I am currently facing the following issue. My Spring Security context refuses an Jwt whose issuer is not https://${okta.domain-name}/oauth2/default. So fine, I generate a Jwt with an issuer of https://${okta.domain-name}/oauth2/default just as they did here Get Access token with Postman - invalid algorithm - #5 by Vladimir. It means that I am now using the default custom authorization server, which is not my intention. Moreover, the User API rejects the request subsequently with a 401 Unauthorised error. I canāt tell why exactly. I guess itās got to do with the scopes. The users Api would need the āusers.manageā scope whereas the custom authorization server has āopenidā and āprofileā scopes. Custom Authorization Servers do not mint access tokens with Okta API Scopes ā Authorization Servers | Okta Developer
āEach authorization server has a unique issuer URI and its own signing key for tokens to keep a proper boundary between security domains.ā - from the link above
āYou canāt mix tokens between different authorization servers. By design, authorization servers donāt have trust relationships with each other.ā - from the link above. The access token generated by the custom authorisation server will not be compatible with the Okta org authorisation server it seems to me.
How could I use the Okta Org Authorization Server instead? It suits perfectly my needs as I do need to validate the Jwt. Iāll leave that to Okta.