Bi-directional Incident Integration Between Two ServiceNow Instances Using OAuth

Mahalakshmi Rav
Tera Contributor

Hi all,

I have a requirement where I need to showcase bi-directional integration between two ServiceNow instances (let’s call them PDI A and PDI B) for the Incident table.

Whenever an incident is created, updated or deleted in one instance, it should automatically reflect in the other instance PDI A to PDI B, and vice versa so changes in PDI B should also sync back to PDI A.

I want to use OAuth 2.0 for authentication instead of basic auth and that's the main requirement here.

Steps which i executed:
1. So far, I have created an OAuth profile in Instance B (as an OAuth client) and created one integration user with the necessary roles and web service access is enabled.

MahalakshmiRav_0-1778705510736.png

MahalakshmiRav_1-1778705628125.png

 

2. In Instance A, I created an OAuth provider profile using the same client ID and secret, set up a REST message and successfully generated an OAuth token. I then created a POST method, but when I try to test 'Create INC http', it’s throwing an error.

MahalakshmiRav_3-1778705898389.pngMahalakshmiRav_4-1778705992449.png

 

MahalakshmiRav_6-1778706102000.pngMahalakshmiRav_7-1778706120524.png

 

I’m not sure what went wrong, can someone please advise?

 

Thanks!

 

1 REPLY 1

Priyanka64
Tera Contributor

Hello @Mahalakshmi Rav 

 

The error in your last screenshot is the key clue: “OAuth token request failed: Illegal token failed with code 400 – Forbidden username password combo” - This indicates that the OAuth token generation itself is failing before the REST API call is executed. Please validate the integration user credentials and ensure the user is active with the required roles assigned.

 

To validate the credentials:

Temporarily uncheck the Web service access only option on the integration user.
Open the instance in an incognito window and log in using the integration user credentials.
Once logged in, verify that the user can access the Incident table and create a new record.
After validation, re-enable the Web service access only checkbox for the user and test the integration again.


If this helps, kindly mark the answer as helpful/correct.

 

Thanks,

Priyanka