- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2020 04:30 AM
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.
Solved! Go to Solution.
- 10,883 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2020 04:41 AM
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
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2020 04:41 AM
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
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2020 10:58 PM
Test OAuth 2.0 using Postman tool to get Access Token: ---> this is the step where I'm getting issue to get the Access and Refresh Tokens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2020 11:42 PM
also I'm able to get the Access token and refresh tokens from 3rd party instance(snow) using background script, but not from postman tool.
Tried the below steps to get the access/refresh tokens using background script.
1. I've created the OAuth Provider Type profile using Source Client ID and Secret and added the Auth and Token URLs of source instance.
2. Using this profile in the background script and using the user details of source instance, I'm able to generate the access/refresh tokens from the background script.
var oAuthClient = new GlideOAuthClient();
var params ={grant_type:"password", username:"itil", password:'itil'};
var json =new JSON();
var text = json.encode(params);
var tokenResponse = oAuthClient.requestToken('OAuth_profile', text);
var token = tokenResponse.getToken();gs.log("AccessToken:"+ token.getAccessToken());
gs.log("AccessTokenExpiresIn:"+ token.getExpiresIn());
gs.log(" RefreshToken:"+ token.getRefreshToken());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2024 07:54 AM
This is finally Working