Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

It is not possible to get an OAuth Token

ncastagnet_mc
Tera Contributor

I just get the response: {"error_description":"access_denied","error":"server_error"}

 

Here's my view in Application Registries:

 

Screenshot 2025-01-10 at 4.29.06 PM.png

As you can see I have a client-id and client-secret set here. Now:

$ curl -XPOST "https://$INSTANCE/oauth_token.do" \
  -H "Accept: application/json" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET"
echo

 This should work but instead it is giving me the "access_denied" error.

 

INSTANCE is my "blah.service-now.com" instance hostname. CLIENT_ID and CLIENT_SECRET are from the values shown in my application registry.

2 REPLIES 2

AshishKM
Kilo Patron
Kilo Patron

Hi @ncastagnet_mc , 

You need to check with the team who has provided that Oauth credentials, the input/output format should match as per SN process. 

 

access_denied, means credentails are not correct or some inputs are missing.

 

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

ChrisBurks
Giga Sage

Hi @ncastagnet_mc ,

 

The ServiceNow documentation for using grant type "Client Credential" for inbound requests looks a little different than your setup. You can find the setup here for more inforamtion: https://www.servicenow.com/docs/bundle/xanadu-platform-security/page/integrate/authentication/concep...

 

But it states as below when and how to use client credentials grant type:

 

Use the OAuth client credentials grant type for Inbound Integrations from a third party OAuth client to the ServiceNow® platform.

The administrators can use the client credential (CC) grant type to enable integration from a third party OAuth client to the ServiceNow platform.

Inbound client credentials grant type is a capability that can be controlled through a system property. By default the system property is false.

To use the client credentials grant type, you must perform the following steps:

  • Create the glide.oauth.inbound.client.credential.grant_type.enabled system property.
  • Add the OAuth Application User field to the OAuth Entity form.

ChrisBurks_0-1736716476094.png