Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

REST Connector - BasicWithAccessToken ConnectionJSON failure even after Successful Response

nikhil
New Contributor III
New Contributor III

Call2_GET_Users.jpg

Screenshot 2024-03-05 184805.jpg

Screenshot 2024-03-05 185035.jpg

   

Hi - We have a REST application which is having a Basic Authentication covered. (Screenshots from Postman attached).

After a lot of different tries, I've managed to have the Connection JSON working similar to the Postman. However, the JSON is working ONLY half.

In the logs I clearly see, the response for the authentication is received as 200 and when the GET call on the User API is invoked within testConnectionParams, the response again comes as 200. I can also see ResponseTextMap to be populated with the result, however, still the connection when saved returns a FAILURE. 

As it can be seen in the logs, the last 2 lines show:

response of testConnectionRest: false

I sense the problem lies here. This should rather be set to true (if my understanding is correct) and then the connection should complete successfully.

Connection JSON:

{
"authentications": {
"acctAuth": {
"authType": "BasicWithAccessToken",
"url": "https://abc/oauth2/access_token",
"httpMethod": "POST",
"properties": {
"grant_type": "client_credentials",
"userName": "username",
"password": "password"
},
"httpHeaders": {
"Accept": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "ExpiredAuthenticationToken",
"retryFailureStatusCode": [
403,
401,
500
],
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed",
"Authentication_MissingOrMalformed",
"Authentication_ExpiredToken",
"The token is expired"
],
"timeOutError": "Read timed out",
"errorPath": "error",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"accessToken": "Bearer TOKEN-REMOVED",
"testConnectionParams": {
"http": {
"url": "https://abc.com/rest/v1/users",
"httpHeaders": {
"Authorization": "${accessToken}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"successResponse": [200],
"successResponsePath": "",
"retryFailureStatusCode": [
403,
401,
500
],
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error"
}
}
}
}
3 REPLIES 3

DixshantValecha
Saviynt Employee
Saviynt Employee

Hi @nikhil,

We are checking on your request and we will keep you posted.

DixshantValecha
Saviynt Employee
Saviynt Employee

Hi @nikhil ,

From the logs, it seems like the connection is being established correctly and the GET request to https://abc.com/v1/users is being made. However, without the complete logs, it’s hard to pinpoint the exact issue. Here are a few things you could check:

  1. Complete Logs: Ensure that you have the complete logs. The logs you provided seem to be cut off at the end. The complete logs might contain more information about why the connection test is failing.

Please validate and do the needful.

 

DixshantValecha
Saviynt Employee
Saviynt Employee

Hi @nikhil,

From your description, it seems like the authentication is successful (status code 200), but the connection test (testConnectionRest) is returning false, which is causing the connection to fail.

The testConnectionRest is likely a function that tests the connection and returns true if the connection is successful and false otherwise. If it’s returning false, it means the connection test is failing.

Response Validation: Check if the response received from the GET call on the User API is as expected. The successResponse field in your JSON is set to [200], which means it expects a 200 status code for a successful connection. However, a 200 status code only indicates that the request was received and understood and is being processed. It doesn’t necessarily mean that the request was successful. You might want to check the actual content of the response to see if it’s as expected.