- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2020 07:59 PM
Hi,
I have created the external client oAuth access token through https://<instance>.service-now.com/oauth_token.do.
How do i use this access token in scripted REST api script for authentication ?
Regards,
Sagaya.
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2020 03:22 AM
Glad to know that it worked.
Please close the thread as answered by marking my response as correct and helpful If I was able to help/guide you.
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-25-2020 06:17 AM
Hi Ankur,
Please find the details below.
Objective : Third party will use my API and access service now instance . For that i have created the "access_token" through https://<instance A>.service-now.com/oauth_token.do.
Then trigger https://<instance A>.service-now.com/api/mamb/ivr through post man. in this API , instead of basic authorization i need to use the oAuth 2.0.
But while i am trying to access the API by pass the oAuth access token , got 401 error.
Steps :
1. Created an OAuth API endpoint for external client in instance A
2. Created the scripted REST API for POST operation in service now. No authentication code written in the script in instance A.
3. In postman call https://<instance A>.service-now.com/oauth_token.do and get the access token .
4. pass the access token in postman POST request API header [Authorization : Bearer <access token value from https://<instance A>.service-now.com/oauth_token.do> and trigger the API which is available in instance A.
5.Response in instance A.
responseBody:{"error":{"message":"User Not Authenticated","detail":"Required to provide Auth information"},"status":"failure"}
http response status_code: 401
Please help to fix this issue.
Regards,
Sagaya Rajan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2020 09:51 PM
Hi Rajan,
Do you have any ACL applied to that Scripted REST API?
if yes and if that user using whose credentials you got the access token doesn't have access to it then it would fail
it should work fine for something like this
Scripted REST External Default
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-26-2020 02:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2020 02:59 AM
Can you share screenshot of how you are calling the actual API with the bearer token.
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-26-2020 03:27 AM