35
Views
2
Comments
Modify scope for Consume API request using OAuth 2.0
Question

Hi fellas,

I'm trying to consume an API which uses OAuth 2.0 authentication and using the OAuth 2.0 client credentials authentication in Service Studio. This works fine, but when I switch environments and try to change the authentication request I find that the scope is not something that can be updated within Service Center. 

Is there a way to dynamically update the scope based on the environment? I could request the token separately but it's just that that would be a bit cumbersome.



2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

Why do you need to change the scope in another environment, doesn't that make the API behave different between environments?

Regards,

Daniel

UserImage.jpg
Quentin P

The API requires that the scope be in the form "{client id}/.default". I do not fully understand the reason for this but I did check with the person in charge of the authentication part and it seems that can't be changed. I believe it may have something to do with this: https://learn.microsoft.com/en-us/entra/identity-platform/scopes-oidc#client-credentials-grant-flow-and-default

The client ID changes between environments and therefore the expected scope value is different.

Side note, I have already switched the code to handle the calling of the token API separately, so this is just a nice-to-have at this point.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.