OAuth flow failure

TannerStrobel
ServiceNow Employee
ServiceNow Employee

Working through the documentation to set up the Microsoft Azure AD spoke: https://docs.servicenow.com/bundle/sandiego-application-development/page/administer/integrationhub-store-spokes/task/set-up-azure.html

I've completed all required steps but am still getting a failure. I decided to use client credentials as my default grant type over the alternative Authorization Code. The below error says the scopes are not valid although based on the documentation they appear so. Screenshots provided. I'm unsure about where you fix ./default to the resource identifier though, assuming that's my issue. 

I'm getting the following failure when I attempt to Get the OAuth Token: 

OAuth flow failed. Verify the configurations and try again. Error detail:invalid_scope, AADSTS1002012: The provided value for scope openid offline_access is not valid. Client credential flows must have a scope value with /.default suffixed to the resource identifier (application ID URI). Trace ID: 4152f2af-3e67-4c28-8814-c54ea2288000 Correlation ID: 9ffbf70c-0a9f-4627-b0c4-f023526a8156 Timestamp: 2022-07-19 17:52:02Z

 

3 REPLIES 3

TannerStrobel
ServiceNow Employee
ServiceNow Employee

I wasn't able to find the problem when using Client Credentials for the Grant Type. Once I updated records to use Authorization Code instead I had no problems and was able to retrieve my OAuth token. I would still prefer to use Client Credentials moving forward if anyone has the answer to the above error I was running into. 

Richard Hine
Tera Guru
Tera Guru

Tanner,

I think your OAuth Entity Scope is wrong, here is an example I am using right now:-

find_real_file.png

For your reference, here is the registration:-

find_real_file.png

OAuth Entity Scope Related List

find_real_file.png

and profile

find_real_file.png

Depending on which MS Product you are using the scope will change. The one shown in the screenshots is the GraphAPI.

Defender 365 is https://api.security.microsoft.com/.default

Securitycenter is https://securitycenter.onmicrosoft.com/windowsatpservice/.default

Hope this all helps,

Rich