Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

Latest OAuth 2.0 Setup in ServiceNow

harshalthak
Giga Contributor

Hi everyone! I'm building a custom application and need to authenticate it with ServiceNow using OAuth 2.0 so it can securely access ServiceNow APIs. It seems that setup steps of OAuth has been changed from UI.

 

Can someone walk me through the setup steps?

- How do I register my application in ServiceNow as an OAuth client?

- How do I get the client ID and client secret?

- Any code examples or libraries that work well with ServiceNow OAuth?

 

Thanks for the help!

3 ACCEPTED SOLUTIONS

Anand__99
Mega Sage

Hi @harshalthak ,

 

ServiceNow now uses the Machine Identity Console to manage inbound integrations.

Follow Steps to setup:

  1. Create a New Integration.

  2. Select Authorization Code (or your preferred grant type).

  3. Fill in your application details.

  4. Define the OAuth Scopes to restrict unnecessary API access and keep it secure.

Refer Link:

https://www.servicenow.com/docs/r/platform-security/authentication/configure-an-oauth-authorization-...

 

Thanks

Anand

View solution in original post

Bhargavi Patel
Kilo Guru

@harshalthak 

It looks like your configuration is mostly correct. A few things I'd check:

  • Make sure the Client ID and Client Secret are correct.
  • Verify that the OAuth Application Registry record is configured to use the Client Credentials grant.
  • Check whether the system property glide.oauth.inbound.client.credential.grant_type.enabled is set to true. If you can't edit it, it could be due to your instance or release.
  • Have a look at System Logs as they may show a more detailed error than the access_denied message.

     

    Please Accept this response as Solution if it assisted you with your question & Mark this response as Helpful.

View solution in original post

Hi  @Bhargavi Patel ,

 

Yes the property "glide.oauth.inbound.client.credential.grant_type.enabled" must be in Global scope. Change you application scope to Global and then create property.

 

Also make sure you have not selected "Enforce token restriction" checkbox. Select only if you have defined REST API Access policies.

 

Thanks

Anand

View solution in original post

7 REPLIES 7

Anand__99
Mega Sage

Hi @harshalthak ,

 

ServiceNow now uses the Machine Identity Console to manage inbound integrations.

Follow Steps to setup:

  1. Create a New Integration.

  2. Select Authorization Code (or your preferred grant type).

  3. Fill in your application details.

  4. Define the OAuth Scopes to restrict unnecessary API access and keep it secure.

Refer Link:

https://www.servicenow.com/docs/r/platform-security/authentication/configure-an-oauth-authorization-...

 

Thanks

Anand

Bhargavi Patel
Kilo Guru

Hi @harshalthak 

In the newer ServiceNow releases, OAuth configuration has moved to the Machine Identity Console.

You can create a new inbound integration by navigating to Machine Identity Console -  Inbound Integrations - new integration  selecting the required OAuth grant type, configuring your application details and defining the necessary OAuth scopes. Once the integration is created, you can use the generated Client ID and Client Secret to authenticate your application and access ServiceNow APIs.

harshalthak
Giga Contributor

Hi @Anand__99  and @Bhargavi Patel ,
Thanks for information,
I have tried by following this steps as suggested from link . I am still not able to authenticate with API. 

For OAuth endpoint:  {{snow_instance}}/oauth_token.do
response:

{
    "error_description": "access_denied",
    "error": "server_error"
}


harshalthak_0-1783888040409.png


Selected OAuth - Client Credentials grant

harshalthak_1-1783888441518.png

 

I was creating field which is glide.oauth.inbound.client.credential.grant_type.enabled = true in sys properties. DO I need to set application Global. I was trying but field is also not editable.

harshalthak_2-1783888652122.png

 


I have attached reference screenshots.

Can anyone please help, what I am doing wrong ?

Hi  @Bhargavi Patel ,

 

Yes the property "glide.oauth.inbound.client.credential.grant_type.enabled" must be in Global scope. Change you application scope to Global and then create property.

 

Also make sure you have not selected "Enforce token restriction" checkbox. Select only if you have defined REST API Access policies.

 

Thanks

Anand