- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 09:07 PM
I am trying to connect to the REST API to get incidents in my service now instance using OAuth code grant flow as described below:
OAuth authorization code grant flow
I can get a code from the first step, but when I try to request the access and refresh tokens I get a 401 unauthorized response with the body:
{"error_description":"access_denied","error":"server_error"}
I use OAuthClient library to post request and my URL is :
https://<instance>.service-now.com/oauth_token.do
My body/query params are:
grant_type=authorization_code&code=<code>&redirect_uri=<uri>&client_id=<id>&redirect=<redirecturl>
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2018 05:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2018 07:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2018 08:33 PM
Not sure why its not working. Its worth giving the below process a shot. They way to get the acess token seems very simple in the below link.
https://developer.servicenow.com/blog.do?p=/post/inbound-oauth-auth-code-grant-flow-part-1/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2018 09:04 PM
I read the attached process before and it worked with postman "Get New Access Token" function, but I need to find out how to get access token with URL request. My application uses URL request.
It confused me for days. ;(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2018 01:18 AM
Problem resolved. If I used postman to post request token URL directly, it will return access_denied. I used my application to redirect by web with the same request and got the access token successfully.
Thank you for the help 🙂