Server_error when trying OAuth for grant_type=client_credentials. How do I fix this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2021 01:54 PM
I am trying to Integration the tool Target Process to ServiceNow. I have created an oauth entry under Application Registry, "Create an OAuth API endpoint for external clients," to connect Target Process to ServiceNow.
Now, I am trying to create an automation rule in Target Process to call a SNOW API and write data. The Snow Scripted REST API ==> WORKS GREAT. Coded, tested, using API Explorer.
In Target Process this is a section of my javascript to get the token from SNOW:
- Labels:
-
Connect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2021 11:21 PM
Are you sending the required data in the header and the body to get the OAuth access token
refer my blog for steps on how to get it from postman. Similar thing can be done from external application
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2021 07:24 AM
- Client Credentials is not a valid choice in ServiceNow.
- I still need to code the username and password in order to get the token.
- In the application, Target Process, I cannot mask the user name or password, which is not desired.
Is there anything else I could look at? Or am I missing something?
Thanks,
Charles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2021 07:34 AM
ServiceNow has everything in terms of user session.
So this is how OAuth works in ServiceNow when you consume ServiceNow's endpoint to get OAuth token
1) to get the 1st Access token + Refresh token you need to send username and password along with other details
2) now when the Access token expires you can regenerate it using the refresh token no need to send username and password
3) now if the refresh token also expires then fresh call using again username and password
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
