- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2016 08:18 AM
Hi,
While doing rest call and providing basic authorization, I am getting an invalid username and password combination. I trying to do sailpoint integration and to test whether all the content json and headers work correctly, I used google chrome postman to send the values as Rest and it worked like a charm. But when using ServiceNow, it throws me an error with invalid user name password combination.
I tried to debug further by adding logs to the BasicAuth Script Include and it shows me that the username password it is authorizing is the one configured for MidServer. Though I have not selected the mid server in my rest message it still is using the midserver user name password. Is there a way to make a direct Rest call without using the mid server?
Thanks,
Venkat
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2016 11:12 AM
Hi Venkat,
This has been recognized as an issue and will be addressed. The workaround is to manually create an "Authorization" header with a value of "BASIC ****". The * value is equal to the base64 encoding of the credentials, username:password.
Here is some sample code to arrive at the encoded credentials.
var username = "my_username";
var password = "my_password";
encodedAuth = GlideStringUtil.base64Encode(username + ':' + password);
gs.print("BASIC " +encodedAuth);
Result -
BASIC bXlfdXNlcm5hbWU6bXlfcGFzc3dvcmQ=
I hope this helps address your concerns.
Regards,
Julio Fernandez
ServiceNow Integrations Team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2021 09:13 AM
Use 'Basic' instead of 'BASIC' to get this to work for flow designer rest step
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2023 09:07 AM
This solved my issue between ServiceNow and SailPoint but the HTTP Header value could not be all capitals. Result was "Basic xxxxxxxxxxxxxxx"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2023 08:43 AM
Hi Heather,
I am still receiving 402 error even after using 'Basic'.
request.setRequestHeader('Authorization','Basic'+encodedAuth);
Below is the code as to how encodedAuth is populated.
var provider = new sn_cc.StandardCredentialsProvider();
var credentials = provider.getCredentialByID("7c8aee7c870aa590aacccaec0ebb355a");
var username = credentials.getAttribute('user_name');
var password = "";
encodedAuth = GlideStringUtil.base64Encode(username + ':' + password);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2023 09:49 PM
@RashiKul
Looks like you missed the space between Basic and encoded credentials.
Regards, Nikolay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2024 09:23 PM
Hello,
I had a similar issue.
In Flow Designer, the REST Step to run REST message requires to provide connection and credential aliases as of basic authentication.
Once I have completed this step and imported REST message in REST Step, I got all the time response code 400 back.
Several hours I tried to debug and at the end I found this.
Basic authentication require user name / password
user name field is max size 40
Supplier provided me with user name long 48 characters.
I increased field size and updated basic authentication record with the full user name again.
All started to work.
PS: What helped was to run REST via background script and than I compared HTTP outbound log with HTTP outbound log created by REST called from flow designer, string of Authentication value from HTTP header started to be the same but after 50 characters changes which helped me to understand and debug this field max size issue.
Hope this post helps to someone
/Petr