- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2015 05:44 AM
Hello,
I believe that there is an error either in the product documentation or the OAuth implementation. Upon requesting an access token with valid credentials, I consistently receive a 401 Unauthorized message.
JSON Response: {"error":"server_error","error_description":"access_denied"}
I've been unsuccessful at making the OAuth implementation work at all. Using the classic Authorization header method works just fine.
Chris
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 10:43 AM
Replying to this post a bit late, so joining the party when this might be resolved. But might be helpful for others
I was also having a similar issue.
JSON Response: {"error":"server_error","error_description":"access_denied"}
Steps taken:
1) Make sure Authorization is "No Auth"
2) Make sure the Body is x-www-form-encoded
curl -X POST \
https:///instance.service-now.com/oauth_token.do \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
-H 'postman-token: 53f8a8f7-f286-607f-1e7e-8dab629081fb' \
-d 'grant_type=password&client_id=ac0dd3408c1031006907010c2cc6ef6d&client_secret=bv4gg7o7akbc18jjy13m&username=admin&password=admin'
3) As a result you would see the Request Headers automatically pulled up as
Now use the access_token in subsequent requests. Adding the header as Authorization: Bearer <access_token>
curl -X GET \
-H 'authorization: Bearer Icru5EyU4ZrgngoB0ecHp_LcXJHm-nB1NBt2QXaEXhYoPZcd6ss6KS4mLGfApGDDsi6ka86zdabHMgKX8doeHA' \
-H 'cache-control: no-cache' \
-H 'postman-token: e2073e4f-d09e-f19b-b510-5779f9ba415a' \
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2017 11:50 PM
HI Mayank,
This works if I try with local user account with credential, I am getting following error if I try AD/LDAP credential,
Error OAuth 2 Response 'Access Token' Request failed: unauthorized (401)
HTTP 401
---Body---
{"error_description":"access_denied","error":"server_error"}
Please advice

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2019 11:25 AM
I know this was two years ago, but this is what solved it for me. Knowing to send in the data as applicatoin/x-www-form-urlencoded. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2019 05:31 AM
I ended up working around this issue at the time by using the XML API since the product documentation on REST was lackluster. This is a good explanation of how to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2021 10:29 AM
Can anyone explain to me why this question referenced the grant type of client_credential, but the accepted solution uses password instead? I have an issue with using grant_type = client_credentials, and need help with that. Any help?