Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Issue - REST API Basic Auth Using Authorization Code in Headers

Sdhillon
New Contributor
New Contributor
We are facing an issue with the REST API connector's ImportUserJSON while importing  users from target application. We are integrating Oracle JDE application (as authoritative source) with Saviynt using REST API. The application uses basic authentication. In the connection JSON, we are using  content-type and Authorization code "Basic XXXXXXXXXXX" in the headers to obtain a token. In the next call, the token is sent in the request body along with other parameters to retrieve the user list. The token is getting generated successfully and updating in the next call (importUserJSON), but authorization fails with the error message “StatusCode:403 Basic Authorization Failed.” However, if we use the same token in Postman, it works fine. 
 
Error message in Logs:
"2024-07-25T17:57:08.633+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-2-j8fhr","DEBUG","Calling Webservice Url - http://<<<<URL>>>>> with httpParams - [Mode:3, EmployeeNumber:xxxx, deviceName:IGA, token:*********************]"
"2024-07-25T17:57:08.633+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","calling executeRequestWithTimeoutConfig for api..."
"2024-07-25T17:57:08.633+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","calling api..."
"2024-07-25T17:57:08.633+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","before calling executeRequestWithHeaders for api..."
"2024-07-25T17:57:08.633+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","isFipsEnabled = false"
"2024-07-25T17:57:08.633+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","getHttpClient - proxyParams : null"
"2024-07-25T17:57:08.633+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","getHttpClient - sslSocketFactory : null"
"2024-07-25T17:57:08.633+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","setting connection timeout to 10 seconds and request timeout to 60 seconds"
"2024-07-25T17:57:08.634+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","getHttpClient - HttpClientBuilder.create().build() called."
"2024-07-25T17:57:08.772+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","called executePostRequestWithHeaders for api..."
"2024-07-25T17:57:08.772+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","after calling executeRequestWithHeaders for api..."
"2024-07-25T17:57:08.772+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","called api..."
"2024-07-25T17:57:08.772+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","timeout validated for api..."
"2024-07-25T17:57:08.772+00:00","ecm-worker","services.HttpClientUtilityService","quartzScheduler_Worker-2-j8fhr","DEBUG","got response for api..."
"2024-07-25T17:57:08.772+00:00","ecm-worker","rest.RestUtilService","quartzScheduler_Worker-2-j8fhr","DEBUG","Got showLogs = true"
"2024-07-25T17:57:08.772+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-2-j8fhr","DEBUG","Got Webservice API Response: [headers:[Date: Thu, 25 Jul 2024 17:57:08 GMT, Content-Type: application/json; charset=UTF-8, Content-Disposition: attachment; filename="ais_response.json", Access-Control-Expose-Headers: Content-Disposition, X-ORACLE-DMS-RID: 0, X-Content-Type-Options: nosniff, Access-Control-Allow-Methods: GET, POST, OPTIONS, X-ORACLE-DMS-ECID: bf7791ab-6eae-4184-85c3-9789e7208c9f-000019e0, Access-Control-Allow-Origin: *, Vary: Origin], responseText:{"message":"Basic Authorization Failed","exception":"E1LoginException","timeStamp":"2024-07-25T13:57:08.690-0400","status":"ERROR","exceptionId":"d1f07c03-826d-42b0-b3f7-028e81e9ac81"}, cookies:[], statusCode:403]"
 
ConnectionJSON:
 
{
    "authentications": {
        "userAuth": {
            "authType": "Basic",
"url": "<<<xxxxxxx>>>>>",
"httpMethod": "POST",
"httpParams":{"deviceName":"IGA"},
            "httpHeaders": {
                "Authorization": "Basic xxxxxx",
                "Content-Type": "application/json"
            },           
            "httpContentType": "application/json",
"errorPath": "message",
            "maxRefreshTryCount": 5,
            "tokenResponsePath": "userInfo.token",
            "tokenType": "",
            "authHeaderName": "Authorization",
"successResponse": [],
        "successResponsePath": "responseText",
        "errorPath": "responseText",
"retryFailureStatusCode": [
        401,
403,
400
      ],
           "accessToken": "abcd"
               
        }
    }
}
 
Note: We have also tried authType BasicWithAccessToken and oauth2 but the results are same.
 
ImportUserJSON
 
{
   "connection":"userAuth",
   "url":"<<<URL>>>",
   "httpMethod":"POST",
   "httpHeaders":{
   "Content-Type":"application/json"
   },
   "httpParams":{"Mode":"3","EmployeeNumber":"xxx","deviceName":"IGA","token":"${access_token}"},
   "httpContentType": "application/json",
   "userResponsePath":"",
      "colsToPropsMap":{
  "username":"NetworkID~#~char",
      "customproperty1":"EmployeeNumber~#~char",
}}
 
The APIs work properly in the postman.
 
Request to Get Token
 
Requests-------------
 
curl --location 'http://' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic xxxxxxxxxxxxxxx' \
--data '{
    "deviceName":"IGA"
}'
 
Postman Request to Get User
curl --location 'http://' \
--header 'Content-Type: application/json' \
--data '{
    "Mode": "3",
    "EmployeeNumber": "12345",
            "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "deviceName": "IGA"
}'
 
Please assist in resolving this issue or provide guidance on what might be going wrong with the connection JSON or ImportUserJSON.
9 REPLIES 9

rushikeshvartak
All-Star
All-Star

Please share postman screenshot and curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]



⚠️‼️‼️Do not upload any attachments that contain sensitive information, such as IP Addresses, URLs, Company/Employee Names, Email Addresses, etc.‼️‼️⚠️


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Please find below the postman screen shots. 

 

Sdhillon_1-1721948028500.png

Sdhillon_3-1721948273952.png

 

 

{
   "connection":"userAuth",
   "url":"<<<URL>>>",
   "httpMethod":"POST",
   "httpHeaders":{
   "Content-Type":"application/json",
"Authorization":"${access_token}"
   },
   "httpParams":{"Mode":"3","EmployeeNumber":"xxx","deviceName":"IGA","token":"${access_token}"},
   "httpContentType": "application/json",
   "userResponsePath":"",
      "colsToPropsMap":{
  "username":"NetworkID~#~char",
      "customproperty1":"EmployeeNumber~#~char",

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

I had already tried using "Authorization":"${access_token}" in the headers, but it throws an error "Basic Authorization Failed".

Sdhillon_2-1721951856022.png

 

Sdhillon_1-1721951714398.png

 

 

Does hardcoded token worked?


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Yes, It only works with hardcoded token if I use Authorization = Basic XXXXXX in the headers (in ImportUserJSON).

Share logs in text format


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

I have attached the log file.

Logs are not relevant 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.