ServiceNow Integration with HP Order Status (OSS) API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2024 12:20 AM
Hello Everyone,
we are currently experiencing difficulties with authenticating our ServiceNow token before invoking the HP Order Status API. We are using the OAuth2 client credentials flow with the API key, secret ID, and client ID. Despite creating the application registry and profile, our authentication attempts are failing with an error message. Has anyone encountered a similar issue or has insights on troubleshooting this authentication problem? Your assistance and expertise would be greatly appreciated!
Link to the HP OrderStatus (OSS) API: HP OrderStatus (OSS) API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2024 11:34 PM
Hi @Rajesh Chopade1 and @Community Alums
we are able to get token in post main using O Auth2.0 but same we are setting up in ServiceNow we are receiving error.
Here's the screenshot of error message.
Regards,
Hitesh Mourya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2024 12:39 AM
means issue in the OAuth setup within ServiceNow.
Verify the points which already i have mentioned above, I hope that resolved your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2024 05:12 AM
Hi @Rajesh Chopade1 ,
Thanks for providing verification points, I have checked each points and we have provided all the information correctly but still facing same error. could you please suggest any other way to get auth token.
Regards,
Hitesh Mourya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2024 05:24 AM - edited ‎09-23-2024 05:26 AM
Try below code in background script and then share me of output.
Don't forgot to replace the client id and secret id and url,
var clientId= "add_the_clientid";
var clientSecret = "add_the_clientSecret";
var appUri = "add_the_appUri";
var url = "https://login.microsoftonline.com/oauth2/v2.0/token";
var payload = "grant_type=client_credentials&client_secret=" + clientSecret + "&client_id=" + clientId + "&scope=" + appUri + "/.default"; // Replace the URL
var request = new sn_ws.RESTMessageV2();
request.setEndpoint(url);
request.setHttpMethod('POST');
request.setRequestHeader("Accept", "application/x-www-form-urlencoded");
request.setRequestBody(payload);
var response = request.execute();
if (response && response.getStatusCode() === 200) {
gs.info(JSON.parse(response.getBody()).access_token);
} else {
gs.error("Error generating auth token: " + response.getBody());
gs.info('null');
}
Regards,
Krishna