Instance A to B Works, but Instance B to A Fails with 401 Unauthorized

dheerajkj
Tera Contributor
Hi Community,
 
I am working on an Incident integration between two ServiceNow instances using REST Messages and a Scripted REST API.
 
Current Status:
 
- Instance A to Instance B is working successfully.
- Incidents are created correctly in Instance B.
- Scripted REST API is active and reachable.
 
Issue:
 
Instance B to Instance A is failing with the following error:
 
HTTP Status: 401 Unauthorized
 
Error Message:
Method failed with code: 401 - Invalid username/password combo
 
Response:
User is not authenticated
Required to provide Auth information
 
What I have checked:
 
- Endpoint URL is correct.
- Authentication is configured in the REST Message.
- Multiple users were tested.
- Newly created users were tested.
- Credentials can be used to log in directly to the target instance.
- The same issue occurs even when other source instances try to call the target instance.
- Instance A to B works, but B to A fails.
 
Questions:
 
1. How can I verify whether the Authorization header is actually being sent from the REST Message?
2. Are there any Scripted REST API authentication settings, ACLs, or roles that could cause this behavior?
3. Has anyone faced a situation where one direction of integration works but the reverse direction consistently returns 401 Unauthorized with "Required to provide Auth information"?
 
Additional Requirement:
 
I also need guidance on:
- Synchronizing attachments on Incident insert and update.
- Synchronizing Additional Comments and Work Notes.
- Returning custom validation messages when mandatory fields are missing.
 
Any suggestions would be appreciated.
 
Thank you.
3 REPLIES 3

Tanushree Maiti
Tera Patron

Hi @dheerajkj 

 

Could you please confirm whether you are using Basic Authentication or OAuth 2.0?

 

If you are using Basic Authentication, please verify the following on Instance A:

  • Ensure that the credentials of the integration user (shared with Instance B) are valid and working correctly.
  • Confirm that the integration user account is not locked out.

 

Thank you for your response.

Both Instance A and Instance B using Basic Authentication. 
The credentials of the integration user are correct.
And also, the user account is not locked out.


 

Hi @dheerajkj 

 

Ensure integration user created in instance A has been marked as "web-service access only" .

Also share the role(s) which you have added to integration user?

 

Did you test it via postman whether credential is working?