ServiceNow OAuth 2.0 Authentication
Tags: servicenow, authentication, oauth2, tutorial
Published: 2021-08-09 13:16:23

---
title: ServiceNow OAuth 2.0 Authentication
published: true
date: 2021-03-22 09:33:00 UTC
tags: #servicenow, #authentication, #oauth2, #tutorial
canonical_url: https://tech.forums.softwareag.com/t/servicenow-oauth-2-0-authentication/239886/1
---

## 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](http://webMethods.io) Integration.

## Prerequisites   

• User needs to have a working **ServiceNow** tenant.  
  
• User needs to have working **[webMethods.io](http://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](http://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.
![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/b/b6b7f816ae56af1ce11acbaf7ca5bd555c232384.png)
3. Register a new App, click “New” button.
![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/7/72c47568708fe6c829c232ae8598890ff334eda6.png)
4. Choose **Create an OAuth API endpoint for external clients** option.
![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/c/c3ed24fe5cde12e739df1d1b0087e0c0a09045ea.png)
5. 
Fill the details like **Name** , **redirect\_url** & other mandatory information as mentioned in the screenshot then click **Submit**.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/4/4ed8e297cd93a533bc9f1cf32efd33abc6eac72a_2_690x348.png)
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**.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/f/f14040f4bee7ff69644f258d32b80a6caccbea8c_2_690x313.png)
8. Code will appear in the **browser** search bar, copy the entire **URL** & take the code.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/6/60a1cc02a2a6dfd50b14080f7c0667563fcfa0be_2_690x278.png)
![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/9/91dde98e1ce9b064f0425c6939338445cbc52892.png)
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](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/7/7393597ad2eab7575d7f91419de93e3532e9b0ba_2_690x345.png)
10. We will login to the **[webMethods.io](http://webMethods.io) tenant** for making the connection of **ServiceNow** & chose the project.
11. Choose the **flowservice** option & click + to make new flow.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/9/913b3ea090b3b7449c7bbd2bd3a4bb627ef176f2_2_690x423.png)
12. Choose the **ServiceNow** application version from the drop down.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/2/2dc757d7ddc629430d855796adc7a621c60bf44c_2_690x328.png)
13. Choose the **predefined** operation from the drop down.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/7/74b5cb43ba3203f98efff13596c3f71d833d9ab5_2_690x304.png)
14. Click the **Account configuration** icon & choose the **Configure Accounts** Option then choose **OAuth V2.0**.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/3/3e50cb725716f6d36911792714f116e3e8d0f286_2_690x267.png)
15. Fill the details mentioned on the page from the postman client & click **Add**.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/4/408e5aedf44ed22f37358eb2763cb17a8d7d6621_2_498x500.png)
16. After successful connection, to run the integration click run button as mentioned below.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/0/0a98ce0c186b5f06e419fc6d4e970a8f92202bb5_2_690x118.png)
17. Below are the results for the successful integration.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/a/aafd33f2aa3227ec4555215b52591deb65bc76a8_2_690x321.png)

[Read full topic](https://tech.forums.softwareag.com/t/servicenow-oauth-2-0-authentication/239886/1)