Token Generation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2015 03:13 AM
I am trying to generate the access token for an application which I have deployed over serviceNow,
Referred the link: http://wiki.servicenow.com/index.php?title=REST_API
Rest API : https://<InstanceName>.service-now.com/oauth_token.do
Request Body:
{"grant_type":"password","client_id":"33eb1705c75f3154400b1237989343b5","client_secret":4gE[IT#5qk,
"username":"UserName",
"password":"Password"}
Response:
Status Code: 401 Unauthorized
{
"error": "server_error",
"error_description": "access_denied"
}
Am I missing anything?
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2015 03:08 PM
Hi Rohit,
You need to use form parameters in your request. Here's an example using curl:
curl "https://<instance>.service-now.com/oauth_token.do" -XPOST --data "grant_type=password&client_id=33eb1705c75f3154400b1237989343b5&client_secret=4gE%5BIT%235qk&username=UserName&password=Password" -v
Note that I have URL-encoded the client secret you provided as it must contain only URL-safe characters.
Hope this helps,
Silas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2015 03:16 AM
Silas Smith Great tip with the URL-encoding for the client_secret!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2015 07:38 PM
Token username need to be send in Header of request.
https://<InstanceName>.service-now.com/oauth_token.do/username
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2015 03:26 AM
And I'm not sure what you mean with the /username Pankaj, all I get when trying to use this is a "Page not found"… have you tested this? And could you elaborate how to use it?