Postman to servicenow using OAuth 2.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @21121A3359, could you please change form-data to x-www-form-urlencoded and try? Also, under Authorization should be set to None.
Regards,
Nishant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Can you make sure your instance has the below property and is set to true
glide.oauth.inbound.client.credential.grant_type.enabled
If it is not there create it and set it to true then test again
https://www.servicenow.com/docs/r/zurich/platform-security/authentication/create-cc-sys-prop.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @21121A3359
401 is authentication error.
- Recommended: Try switching between "Send as Basic Auth header" and "Send client credentials in body".
- ServiceNow typically expects credentials in the request body for the /oauth_token.do endpoint
2) In your Target system from where you've received Client ID and Secret, ensure the "Default Grant type" is set to "Client Credentials" and "OAuth Application User" as your Rest User profile with right level of API access/roles.
Refer: OAuth 2.0 Client Credentials works in Postman but not from ServiceNow-to-ServiceNow (401 error)
3)
- Header: Content-Type: application/x-www-form-urlencoded.
- Body: Ensure you are using x-www-form-urlencoded format, not raw JSON
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Your error message is clear.
It's missing the user to authenticate.
It requires a user and password AND client ID and secret for OAuth 2.0.
In your Postman, in the authorization tab, you are going to set Auth Type: OAuth 2.0 and add all the required fields:
Grant type: Client Credentials
Access token URL: your instance URL/oauth_token.do
Client_ID
Client_secret
Client authentication: Send as basic auth header
In the Body tab (in Postman) you will add the username authorized to login to get the token, the password for that account, granty_type as password, the client ID and secret.
Once done, you will go back to the Authorization tab in Postman and click the Get New Access Token and then Use Token in the pop-up window.
Try that and let us know.