- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2018 02:34 AM
I configured an OAuth user to generate auth access_token & refresh_token, whenever we invoke "oauth_token.do", first time it returns both token, but when we start consuming that token to get Incident details it shows random errors. Firstly it shows "ACL" error and in a 2nd attempt, it returns blank JSON output as [].
Then if we try to hit "oauth_token.do" API again to get tokens, it also starts returning some javascript error as "This site requires JavaScript to be enabled" with entire Javascript code. (refer attached error file)
I am unable to figure out, why is this API misbehaving sometimes without any changes? Is someone faced the same issue or anyone can help me to resolve this?
Thanks in advance.
Attached the error log & images for Oauth APIs.
Regards,
Dheeraj Namdeo
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2018 07:22 AM
Then if we try to hit "oauth_token.do" API again to get tokens, it also starts returning some javascript error as "This site requires JavaScript to be enabled" with entire Javascript code. (refer attached error file)
I faced the exact same issue. I believe its something to do with PostMan, the initial request to obtain access_token and refresh_token works for oauth_token.do. But after we consume it, it says "This site requires JavaScript to be enabled" (with a Login Screen).
Though we get this in Post Man for testing purposes, we never got this issue in real time production environment(As they dont use PostMan)
Note:- I only saw this behavior with Grant Type of Resource Owner Password Credentials. (Or simply grant type = password)
Please mark the answer Correct/Helpful if applicable so that it will help others in future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2018 04:00 AM
Hi Dheeraj,
In this case ServiceNow is the consumer and you have configured the OAuth profile in the instance right?
you need not send the refresh token in body.
you have properly sent the header with Authorization as Bearer <AccessToken> but result is empty. Do you have any records matching that filter condition in the url of endpoint.
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
08-16-2018 04:27 AM
Hey Ankur,
In our case, we will be consuming Service Now Table APIs to get/update records in ServiceNow from outer world & yes we configured Oauth user in servicenow for"Create an OAuth API endpoint for external clients".
Regards,
Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2018 04:35 AM
Hi Dheeraj,
I have worked on OAuth authentication for ServiceNow as the provider. The 3rd party was able to connect seamlessly via OAuth details I shared. No issue till now.
As per your screenshot the steps to consume the endpoint looks good. just check the query condition you applied in the url. have a simple query to fetch active incidents
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
08-16-2018 04:57 AM
First of all Thanks ankur to look at this & replying us.
To answer you,
1. "you need not send the refresh token in body."
This API call will only happen when our Access_Token will expire & needed new Token, however for testing purpose, we are hitting this API without expiring the earlier Access_token, will it create any issue?
2. "you have properly sent the header with Authorization as Bearer <AccessToken> but the result is empty. Do you have any records matching that filter condition in the url of endpoint."
Yes, i have a proper record & same API returns sometime as well with AccessToken.