Getting Access Denied while getting access token

Mitalee
Kilo Contributor

Hi,

I am trying to login using OAuth2.0. I received the auth code. Using the same auth code I tried to get the access token but getting error as below:

{
"error_description": "access_denied",
"error": "server_error"
}
 
Thanks & Regards,

Mitalee Jadhav

 

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Mitalee,

so you are trying to get the access token from servicenow using the below url

http://<instance-name>.service-now.com/oauth_token.do

but getting access denied error

are you using correct username and password?

are you using http post method?

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Mitalee
Kilo Contributor

Hi Ankur,

Thanks for your response.

We are using the same URL only as POST method. We tried with both Admin & another defined User. But still we are getting the same error. We are trying in POSTMAN. We have attached the screenshot of the error.

Please help.

Thanks & Regards,

Mitalee

Hi Mitalee,

So OAuth token you have received. Now when trying to hit the actual endpoint you need to send this token in header as

give your actual endpoint; method and below value; if you are using POST method then send request body

Authorization Bearer <accessToken>

find_real_file.png

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Mitalee
Kilo Contributor

Hi Ankur,

Thank you for your response.

We procured the Auth code using http://<instance-name>.service-now.com/oauth_auth.do

Now we are trying to procure the access_token using http://<instance-name>.service-now.com/oauth_token.do where we are getting access denied message.

Thanks & Regards,

Mitalee