OAuth 2.0 getting access token issue on postman

Sreedhar M
Kilo Expert

I'm trying to generate the access/refresh tokens using postman.

I have given Get method and provided the instance url as https://xxxxxx.service-now.com/oauth_token.do and under headers section, provided all the required key value pairs, like client id, secret, username, password and grant type.

And when I hit Send button , getting the below error,

{

   "error_description": "access_denied",

   "error": "server_error"

}

please help me to get the tokens.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Sreedhar M 

I have written a blog for this

Please refer the same and do remember to mark it as helpful and also bookmark if that helps

OAuth 2.0 with Inbound REST

Regards
Ankur

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

View solution in original post

27 REPLIES 27

From Servicenow, I'm using Rest Message and adding the OAuth 2.0 as Authentication and adding the profile which I have created using the Provider instance client id and client secret. And I'm getting the token from the Rest message using 'Get Auth Token' and I'm giving simple user details to get the token and it is generating the token and able to test from default Get HTTP Method successfully with 200 response. Not using admin user to generate token here. But when I try to get token from postman, getting issue.

Hi,

I believe you are getting confused

REST Message is configured when you wish to consume 3rd party endpoint

But your question talks about getting access token generated by ServiceNow

Regards
Ankur

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

@Ankur Bawiskar  I was under impression that we can generate tokens from postman or 3rd party instance. Because when i generate tokens on 3rd party instance(snow) from Rest Message it had generated the tokens on source instance(provider) also. Now I'm really confused. Please correct me.

Hi,

So here is an example

1) ServiceNow is the provider of REST API and wants 3rd party to use OAuth to access it's endpoint

Another example

2) ServiceNow is the consumer of REST API given by 3rd party so you will have to create REST Message to consume their endpoint and use OAuth if 3rd party has shared the details for the same

Regards
Ankur

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

@Ankur Bawiskar these two steps I understood and that is how I did in my practice after watching your video and some other videos and your blog. My only issue is, POSTMAN not generating the tokens as part of testing.