How to generate Access Token from the OAuth Token URL for the Grant type client credentials

rahulrockkk
Tera Contributor

Hi Team,

 

Could you please provide your support to generate the access token for SCIM integration with the grant type as client credentials in ServiceNow?

 

Please check and provide your inputs. 

 

 

Thanks & Regards

Rahul Chander

2 ACCEPTED SOLUTIONS

@rahulrockkk 

 

Refer below link for more details on different OAuth grant types

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1647747

 

Use below article to configure client credentials grant type in ServiceNow and test in Postman,

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1645212

 

If this helped to answer your query, please mark it helpful & accept the solution. 

 

Thanks,

Bhuvan

View solution in original post

@rahulrockkk 

 

Create system property as below,

 

Name : glide.oauth.inbound.client.credential.grant_type.enabled

Type : true | false

Value : true

Bhuvan_0-1757175954988.png

Create OAuth API end point for external clients as per earlier steps provided. Test using Postman,

Bhuvan_2-1757176162085.png

As per community guidelines, you can accept more than one answer as accepted solution. If my response helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@rahulrockkk 

So from ServiceNow you are calling SCIM integration and want to get Access token?

You can use script to obtain the refresh and access token from script, script will vary based on grant type somewhat

refer below links

OAuth2.0: Get new Access Token from existing Refresh Token

How to Setup OAuth2 authentication for outbound RESTMessageV2 integrations

OAuth : Script to Automate Token Request

How to generate the access token once it is expired from Business Rule?

How to get Auth Token using script when grant type is Authorization code

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi,

 

Thanks for the response.

 

I am just trying to get the access token using oauth token with the grant type - client credentials. But am getting error as - 

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

Bhuvan
Tera Sage

@rahulrockkk 

 

If you have setup OAuth in ServiceNow and SCIM is using ServiceNow provided OAuth, use below

 

1. Create OAuth configuration in ServiceNow. Make a note of client ID and client secret to be used in API call

 

2. Create integration user with web service access to be used for initial OAuth call

 

3. Make a API call from SCIM to get access token & refresh token. Once refresh token is available, use it to get access token and refresh token for subsequent calls

 

Please see below for sample API calls from Postman and process is similar for any third-party tool using ServiceNow as OAuth Provider

 

OAuth Using Integration User Credentials [First time to get refresh token]

 

Bhuvan_0-1757173461308.png

OAuth Using Refresh Token [subsequent calls once initial refresh token is fetched]

Bhuvan_1-1757178553378.png

If this helped to answer your query, please mark it helpful & accept the solution. 

 

Thanks,

Bhuvan

Hi Bhuvan,

 

Thanks for the response. I am trying to set the grant type as client credentials. Could u pls provide ur inputs.