- 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
‎09-04-2015 04:23 AM
Hi Venkat,
Using Rest API client (chrome extension) I can get successful response, but coming Oracle to servicenow it states Unauthorized (401) so within Servicenow do I have to enable some properties to allow and authenticate and send success response from Servicenow. That is what I am looking for.
Thanks
Allwyn

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2015 07:07 AM
Hi Allwyn,
I'm not familiar with using oracle plsql to make web service requests. If you have the request to get an oauth token working from a tool such as advanced rest client that helps you build and send web service requests then the next step I would suggest is to work on configuring oracle plsql to make the same web service request. Not being familiar with Oracle plsql I can't help you with syntax to do that but there may be someone else on the community that has done this before. My suggestion would be to create another separate post on the ServiceNow community and include what you are trying to do in the title something like 'requesting oauth token via plsql'. Having this in the title would make if more likely that someone with oracle plsql experience may find and respond to your post.
It may also be helpful to be able to see the http requests that are being made by your plsql code so you can compare the url, headers, payload with the request you are making from advanced rest client. A tool I've used in the past to help with this is RequestBin — Collect, inspect and debug HTTP requests and webhooks
Which allows me to make a request to a HTTP endpoint (hosted by requestbin) and then see exactly what my request looked like.
Hope that helps,
Bryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2015 07:22 AM
Bryan,
Thanks for your response. There is nothing wrong in plsql syntax at all, I have used similar code to integrate Salesforce as well no issues at all, I was able to get the SFDC access token and perfom subsequent calls, we have verified it works in Chrome Advance REST API Client now we are passing on the same url from a Oracle database it fails with Unauthorized error message, I have downloaded certificate and installed is there anything else needs to be done on the Dev instance? I could open a new request on the community as well.
Thanks
Allwyn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 09:43 AM
Hi,
I've been reading this thread. I'm experimenting a pretty similar issue but with a difference:
I do can get the access token performing a request to my dev instance, where I registered my app to get client ID and secret.
However when I try to perform a similar request to another service now instance, I get the error:
401
{"error":"server_error","error_description":"access_denied"}
Should I register my app on the second service now instance in order to get new id/secret, in case I want to query data from that other different instance?
Thanks in advance!
- 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' \