ServiceNow OAuth 2.0 Authentication

Summary

This article describes the step-by-step process of registering an application with ServiceNow tenant & generating the Access token as well as configuring the account in webMethods.io Integration.

Prerequisites

• User needs to have a working ServiceNow tenant.

• User needs to have working webMethods.io Integration tenant.

Contents

• Create & configure an App in ServiceNow tenant.

• Generating the Access_token & Refresh_token using the rest client.

• Configuring the ServiceNow account in webMethods.io Integration.

Steps

  1. Login in to ServiceNow Portel.

  2. Search for the “OAuth” in the search bar & choose the “Application Registry” option under the System OAuth.

  3. Register a new App, click “New” button.

  4. Choose Create an OAuth API endpoint for external clients option.

  5. Fill the details like Name, redirect_url & other mandatory information as mentioned in the screenshot then click Submit.

  6. OAuth application is ready to use, we need to generate the authorization_code. To generate the code, user need to send the request call on the browser with below URL.

    https://.service-now.com/oauth_auth.do?response_type=code&redirect_uri=<redirect_url>&client_id=<client_id>&state=active

  7. After hiting the above url in the browser, user will get the prompt as mentioned in the screen shot, user needs to allow this by clicking on the ALlow.

  8. Code will appear in the browser search bar, copy the entire URL & take the code.


  9. Now, will use the POSTMAN client, to generate the access token. As mentioned in the below steps: -

POST https://.service-now.com/oauth_token.do

Body: x-www-form-urlencoded

grant_type: authorization_code
code: <generated ion step 8>
redirect_uri: App redirect_uri.
client_id: generated at the time of app creation.
client_secret: generated at the time of app creation.

image

  1. We will login to the webMethods.io tenant for making the connection of ServiceNow & chose the project.

  2. Choose the flowservice option & click + to make new flow.

  3. Choose the ServiceNow application version from the drop down.

  4. Choose the predefined operation from the drop down.

  5. Click the Account configuration icon & choose the Configure Accounts Option then choose OAuth V2.0.

  6. Fill in the details mentioned on the page from the postman client & click Add.

  7. After successful connection, to run the integration click run button as mentioned below.

  8. Below are the results for the successful integration.