Can we encrypted basic auth password in scripts for outbound integration?

rahulg
Tera Contributor

Hi 

 

Background

We have outbound integration from catalog item to middleware, which is then connected to the 3rd part tool. We have a script include function for the rest message (ie content type, authe, etc). And are using the static token for login credentials. This request and response go through a mid-server.  everything was working fine until now. 

 

They removed the middleware and developed the new API for catalog item and the 3rd part tool, gave us the new endpoint for testing, and gave the new encrypted user and password (earlier we were using the token for auth).

Questions

I started testing with a new endpoint and encrypted credentials. Update the script with username and password as shown below. 

                       rest.setBasicAuth("username", "encrypted password");

Note: encrypted password is a very lengthy one

 

While testing, I always get a response code 401 (Method failed: ...../xyz/proxy/ Invalid username/password combo), but when I ask them about this error, they tell me the username and password are right, and it's verified and tested. I don't what the issue is. I am not able to figure it out.

 

What might be the problem:

Is it the mid-server?

Is the encrypted password which is lengthy or should it be decrypted?

 

Please help me with this analysis and resolve the issue.

 

Thanks 

Rahul 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Soeren Maucher
Mega Sage

Hello @rahulg


to me it sounds like they already provided you the Base64-encoded username and password. 
If thats the case, then you can pass this value directly in the Header via the Authorization parameter. 
See the following screenshot and link explaining basic authentication: 
community6.PNG

https://www.debugbear.com/basic-auth-header-generator

I hope this helped!

Greetings, 
Sören




View solution in original post

4 REPLIES 4

Soeren Maucher
Mega Sage

Hello @rahulg


to me it sounds like they already provided you the Base64-encoded username and password. 
If thats the case, then you can pass this value directly in the Header via the Authorization parameter. 
See the following screenshot and link explaining basic authentication: 
community6.PNG

https://www.debugbear.com/basic-auth-header-generator

I hope this helped!

Greetings, 
Sören




Hi @Soeren Maucher 

 

Thanks for taking the time to respond to my question. 

 

They did not give me the token or the above-mentioned authorization, but they gave us the username and encrypted password.

 

Thanks 

Rahul

Pavankumar_1
Mega Patron

Hi @rahulg ,

1. Can you try to give user name password on REST Message Authentication tab?

Create Basic Auth Profile and give user name and password and no need to set on business rule again.

Screenshot (235).png

2. The error is 401 may be check with third party team and make sure those credentials are valid and also

try with test payload.

Using Post man.

If you have Sample payload give some dummy values and test on the postman and you can verify response as well.

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Pavankumar_1
Mega Patron

Hi @rahulg ,

have you checked my response ?

If not try and let me know if need anything or if it resolved accept the solution and hit Thumb icon.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar