Notifications

54 views

Description

This article explains how to set up the ServiceNow instance as OAuth Client with grant type 'Resource Owner Password Credentials'  to provide access_token and refresh_token .

Access_token is used to access the resources on the instance.

 

Instructions

Setting up ServiceNow instance as a OAuth Client:

1)System OAuth -> Application Registry -> New -> Create an OAuth API endpoint for external clients

2) Configure the OAuth Application Registry

a)Name - Provide a name

b)Default Grant type - Resource Owner Password Credentials

c) Client ID - Auto Generated

d)Client Secret - Auto Generated 

e)

f)Access Token Lifespan - Leave the default value (1,800 seconds=30 minutes)

Save the record .

Obtaining the Access and Refresh Token from 3rd party client like POSTMAN:

From the POSTMAN Rest Client

1) Method = POST

2) URL = https://<instance_name>.service-now.com/oauth_token.do

3) Body -> x-www-form-url-encoded

Define the below KEY : VALUE pairs

grant_type:password

client_id: <client id from step 2 c>

client_secret:<client secret from step 2 d>

username:<instance admin username>

password:<instance password>

4) Clicking on Send will return 'access_token' and 'refresh_token' from the instance

5) To get a new access_token using the refresh_token send the following body

Body -> x-www-form-url-encoded

Define the below KEY : VALUE pairs

grant_type:refresh_token

client_id: <client id from step 2 c>

client_secret:<client secret from step 2 d>

refresh_token:<value of refresh token>

Access the resource on the instance using the access token:

From the POSTMAN Rest Client

1)Method=GET

2)URL=https://<instance_name>/api/now/table/incident?sysparm_limit=1

3) Authorization=No Auth

4)Headers:

Authorization:Bearer <value_of_access_token>

 

Article Information

Last Updated:2019-09-09 20:23:26
Published:2019-09-10