OAuth Access Token: Profile? Is there a way to determine its instance ID, scopes, and App?

jeff00seattle
Kilo Guru

Post successful request for an OAuth access token, using ServiceNow REST API to review this access token's profile?:

  1. For what instance has this access token be authorized to access?
  2. What scopes are permitted when accessing this authorized instance?
  3. Global access to all apps within instance, or specific app within instance?
  4. How soon will this access token expire?

Thank you.

1 ACCEPTED SOLUTION

Tushar
Kilo Sage
Kilo Sage

Hi @jeff00seattle 

 

You will need to make an HTTP GET request to the Token API, providing the access token you received during the OAuth authentication process -

 

GET https://<your-instance>.service-now.com/oauth_token.do?sysparm_action=get&sysparm_oauth_token=<your-access-token>

 

The response from this API call will contain information about the access token,  

Here's a sample JSON response structure:

{
   "instance_name": "your-instance-name",
   "scope": "read write",
   "expires_in": 3600
}

 

In this example, the access token is authorized for the "your-instance-name" ServiceNow instance, with "read" and "write" scopes, and it will expire in 3600 seconds (1 hour).

 

Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Regards,
Tushar

View solution in original post

2 REPLIES 2

Tushar
Kilo Sage
Kilo Sage

Hi @jeff00seattle 

 

You will need to make an HTTP GET request to the Token API, providing the access token you received during the OAuth authentication process -

 

GET https://<your-instance>.service-now.com/oauth_token.do?sysparm_action=get&sysparm_oauth_token=<your-access-token>

 

The response from this API call will contain information about the access token,  

Here's a sample JSON response structure:

{
   "instance_name": "your-instance-name",
   "scope": "read write",
   "expires_in": 3600
}

 

In this example, the access token is authorized for the "your-instance-name" ServiceNow instance, with "read" and "write" scopes, and it will expire in 3600 seconds (1 hour).

 

Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Regards,
Tushar

jeff00seattle
Kilo Guru

@Tushar  

Thank you for your reply.

 

Is there a way to determine the InstanceID from an accessToken without using an endpoint that requires knowing the InstanceID?