What is the difference between grant_type as "client_credentials" and "password"

ThirupathiP
Tera Contributor

What is the difference between 'grant_type' as "client_credentials" and "password" when to choose which one creating the authentication token in detail.

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@ThirupathiP 

if you are exposing an endpoint for external system to consume then grant_type=client_credentials was introducted in Washington, mostly used in machine to machine API call without any user credentials shared

Up Your OAuth2.0 Game: Inbound Client Credentials with Washington DC 

grant_type=password will require ServiceNow to share userID and password to external systems, which nowadays not many customer use now

Client Credentials Grant – ServiceNow

Client Credentials Grant Workflow – ServiceNow

Configure an OAuth Client Credentials Grant – ServiceNow

Inbound Client Credentials – ServiceNow

Resource Owner Password Grant – ServiceNow

Resource Owner Password Grant Workflow – ServiceNow

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

I'm using solarwinds Austrila serviceNow version when i use grant_type as "client_credentials" getting  401 unauthorized error. but when use grant_type as "password" getting proper response access and refresh token present in the response. why it is not working for  grant_type as "client_credentials"?

@ThirupathiP 

did you check this and configure properly?

Connect to a third-party OAuth provider 

also ensure you have OAuth entity profile with same grant type

check this

ServiceNow Community OAuth 2.0 Setup Article

share your config screenshots

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

moumitakart
Tera Contributor

Hi

1) you can check the system property is enabled or not in new version if not please Enable the Client Credentials Property or if not present then create it new.

Enable Client Credentials grant

  • In System Properties (sys_properties.list), create/update:

    Name: glide.oauth.inbound.client.credential.grant_type.enabled  
    Type: true|false  
    Value: true

2) Match the Request Content-Type

ServiceNow's OAuth endpoint (/oauth_token.do) strictly requires the body to be formatted as URL-encoded data. [1]
  • Ensure your API client (e.g., Postman, Curl, or code) uses application/x-www-form-urlencoded.
  • Do not send the client ID and secret as raw JSON (application/json)

3) Check the Mapped User Account Status

Because grant_type=client_credentials authenticates as a background system machine, ServiceNow impersonates the user linked in the OAuth Application User field.
  • Open the User (sys_user) record for that account in ServiceNow.
  • Ensure Active is checked (true).
  • Ensure Locked out is unchecked (false).
  • Ensure the user has the rest_service role (or appropriate permissions to access the API endpoints)
4) Remove Basic Auth Headers
If your working username/password script used HTTP Basic Authentication headers (e.g., Authorization: Basic <base64>), remove that header completely. Sending a Basic Auth header containing old user credentials alongside a client_credentials POST body will confuse the ServiceNow endpoint and cause a 401 conflict.
 
 
Thank you