Calling ServiceNow get token API from another ServiceNow instance or third-party application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 12:02 AM
Hello everyone,
I'm trying to call ServiceNow get token API from another ServiceNow instance/ third party app. It shows below error message:
"Status: 401 {"error_description":"access_denied","error":"server_error"}".
I have tried using postman it is working fine. Also I created application registry record of type 'Create an OAuth API endpoint for external clients'.
Can anyone help me on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 03:55 AM
Hi @Kajal8 ,
The "access_denied" error message usually indicates that the request failed due to incorrect or missing authentication credentials. It's possible that the ServiceNow instance or the third-party app that you're calling the API from is not properly authenticated.
Here are a few steps you can take to troubleshoot the issue:
Check if the credentials are correct: Ensure that you're using the correct credentials for the ServiceNow instance you're calling the API from. If you're using OAuth, make sure that you have the correct client ID and secret.
Check if the credentials have the required permissions: Ensure that the credentials you're using have the required permissions to call the get token API. If you're using OAuth, check if the client ID you're using has the required scopes.
Check if the endpoint URL is correct: Double-check the endpoint URL you're using to call the get token API. Make sure that the URL is correct and that there are no typos.
Check if the request headers are correct: Ensure that you're passing the correct headers in the API request. Make sure that you're passing the correct Content-Type, Authorization, and Accept headers.
Check if the API endpoint is reachable: Ensure that the API endpoint is reachable from the ServiceNow instance or the third-party app you're calling it from. If the API endpoint is behind a firewall or a proxy server, make sure that you have the necessary permissions to access it.
Thanks,
Ratnakar