How to retrieve token utilizing client_credential grant type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2022 10:20 AM
Currently I am utilizing the `password` grant type to retrieve tokens from my instance. However, I would like to try and switch to `clientCredentials` so I don't require user credentials to retrieve tokens. I am using the endpoint `https://instance.service-now.com/oauth_token.do` with the below form.
{
grant_type: 'client_credentials',
client_id: 'id',
client_secret: 'secret'
}
However, when I run this request in Postman, I get a 401 Unauthorized error from my instance.
{
"error_description": "access_denied",
"error": "server_error"
}
So, is there something additional I need to configure in order to retrieve tokens? Am I missing something? Any help would be appreciated.
- Labels:
-
Personal Developer Instance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2022 11:10 AM
Hi,
Client credential flow works as given below:
- The Client Application requests an access token from the Authorization Server by passing it's credentials.
- The Authorization Server authenticates the client by validating the client_id and client_secret. Once Validation is successful and if request is valid, it sends an access token.
- Client Application sends the received access token to Resource Server to access the resource end point.
- Resource Server validates the access token by calling Authorization Server.
- If the token is valid, resource server return the requested resource to Client Application.
Make sure you are using correct client_id and Client secret. And Grant type is set as 'Client Credential' in ServiceNow Oauth Application.
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2022 06:41 AM
Thanks for your response Anil!
So far I have confirmed the client id and secret but am still unable to get a token on my end. Perhaps I may have created an application incorrectly in the Application Registry?