Click HERE to see how Saviynt Intelligence is transforming the industry. |
04/17/2024 08:06 PM
Hello,
We've encountered an issue with our REST connection—it begins to fail after a few hours. Our analysis suggests that the root cause may be the connection's inability to retrieve an updated status token once the initial token expires. We also suspect that although we receive a token failure in the response payload after expiration, the response code remains 200.
We're seeking assistance in resolving this matter.
Below is the JSON configuration for the connection:
{
"authentications": {
"userAuth": {
"authType": "oauth2",
"url": "https://<appurl>/token",
"httpMethod": "POST",
"httpParams": {
"applicationId": "<id>"
},
"httpHeaders": {
"contentType": "application/json"
},
"httpContentType": "application/json",
"expiryError": "107",
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed",
"FAILURE",
"INVALID_SESSION_ID"
],
"retryFailureStatusCode": [
500,503,502,501,504,400,401,403
],
"timeOutError": "Read timed out",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "data.accessToken",
"tokenType": "Bearer",
"accessToken": "Bearer abc",
"testConnectionParams": {
"http": {
"url": "https://<appurl>/token",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"successResponses": {
"isSuccessful":true
},
"unsuccessResponses": {
"isSuccessful":false
},
"errors": ["Couldn't authenticate you"],
"errorPath": "error"
}
}
}
}
Below is the response we received for the authentication API from the application:
Response status code is 200
{
"pipelineId": null,
"stationId": null,
"code": 107,
"message": "Token has expired. Please login again",
"isSuccessful": false,
"data": null
}
Regards,
Jagadeesh
04/17/2024 08:13 PM
It seems app is using refresh token
Share Please share curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]
04/17/2024 09:03 PM
Hi @rushikeshvartak ,
Below is the curl command for the same:
curl --location 'https://<app_url>/token' \
--header 'Content-Type: application/json' \
--data '{
"applicationId" : "<app_id>"
}'
Response:
{
"pipelineId": null,
"stationId": null,
"code": 0,
"message": "The operation completed successfully.",
"isSuccessful": true,
"data": {
"accessToken": "<access_token_value>",
"refreshToken": "<refresh_token_value>"
}
}
04/17/2024 09:13 PM
{
"authentications": {
"userAuth": {
"authType": "oauth2",
"url": "https://<appurl>/token",
"httpMethod": "POST",
"httpParams": {
"applicationId": "<id>"
},
"httpHeaders": {
"contentType": "application/json"
},
"httpContentType": "application/json",
"expiryError": "107",
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed",
"FAILURE",
"INVALID_SESSION_ID"
],
"retryFailureStatusCode": [
500,503,502,501,504,400,401,403
],
"timeOutError": "Read timed out",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "accessToken",
"tokenType": "Bearer",
"accessToken": "Bearer abc",
"testConnectionParams": {
"http": {
"url": "https://<appurl>/token",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"successResponses": {
"isSuccessful":true
},
"unsuccessResponses": {
"isSuccessful":false
},
"errors": ["Couldn't authenticate you"],
"errorPath": "error"
}
}
}
04/17/2024 09:35 PM
Hi @rushikeshvartak ,
The Test connection parameters you have provided won't work as this api returns 404 error as GET command is not available for this endpoint.
"http": { "url": "https://<appurl>/token", "httpHeaders": { "Authorization": "${access_token}" }, "httpContentType": "application/json", "httpMethod": "GET" }
I also tested updating the connection params and the connection is failing with the JSON you provided.
04/17/2024 10:04 PM
remove test connection param and try import
04/17/2024 10:36 PM
I've already attempted that approach, and the connection remains successful. However, the issue persists with the import process failing after a few hours, indicating that the connection eventually encounters problems. It's worth noting that this issue doesn't manifest during the test connection because the test connection parameters aren't present in that scenario.
04/18/2024 07:23 PM
What is validity of token
04/18/2024 07:49 PM
Token lifetime is 8 hours
Regards,
Jagadeesh
04/18/2024 08:00 PM
Does application support refresh token ?
04/19/2024 12:57 AM - edited 04/19/2024 12:58 AM
Hi @rushikeshvartak ,
The application supports refresh token. Could you please help with the Connect account JSON using the details below.
Below are the API's supported for the application authentication:
1. Request Access Token API:
a. Request:
curl --location 'https://<application_instance_name>/api/common/external-application-token/token' \
--header 'Content-Type: application/json' \
--data '{
"applicationId" : "<application_id>"
}'
b. Response
{
"pipelineId": null,
"stationId": null,
"code": 0,
"message": "The operation completed successfully.",
"isSuccessful": true,
"data": {
"accessToken": "<access_token>",
"refreshToken": "<refresh_token>"
}
}
2. Request Access Token using refresh token API:
a. Request:
curl --location 'https://<application_instance_name>/api/common/external-application-token/refresh-token' \
--header 'refresh_token: <refresh_token>' \
--header 'Content-Type: application/json' \
--data '{
"applicationId" : "<application_id>"
}'
b. Response:
{
"pipelineId": null,
"stationId": null,
"code": 0,
"message": "The operation completed successfully.",
"isSuccessful": true,
"data": {
"accessToken": "<access_token>",
"refreshToken": "<refresh_token>"
}
}
Regards,
Jagadeesh
04/19/2024 11:30 AM
Refer https://docs.saviyntcloud.com/bundle/REST-v24x/page/Content/Examples-for-JSON-Construction.htm
05/05/2024 10:03 PM - last edited on 05/05/2024 10:59 PM by Sunil
Hi @rushikeshvartak ,
I tried creating the JSON but it is giving connection failure. Also, i am just curious that the API always returns '200' response status code, even when API is failing. It returns error in response payload. Is it affecting the Connection retry not happening after few hours?
Below is the constructed JSON
{
"authentications": {
"userAuth": {
"authType": "oauth2",
"url": "https://removed/api/common/external-application-token/token",
"httpMethod": "POST",
"httpParams": {
"applicationId": "3c79e108-c834-47d3-b916-b25f41132f84"
},
"httpHeaders": {
"contentType": "application/json"
},
"httpContentType": "application/json",
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed",
"FAILURE",
"INVALID_SESSION_ID"
],
"retryFailureStatusCode": [
500,
503,
502,
501
],
"timeOutError": "Read timed out",
"errorPath": "errors.type",
"maxRefreshTryCount": 5,
"tokenResponsePath": "data.accessToken",
"refreshType": "RefreshToken",
"tokenType": "Bearer",
"accessToken": "Bearer abc",
"refreshToken": "<>",
"refreshTokenAuthError": [
"Unable to retrieve SAML assertion",
"The provided SAML assertion is expired"
],
"refreshTokenErrorPath": "errorMessage",
"refreshTokenCall": {
"refreshTokenResponsePath": "data.refreshToken",
"url": "https://removed/api/common/external-application-token/refresh-token",
"httpMethod": "POST",
"httpParams": {
"applicationId": "3c79e108-c834-47d3-b916-b25f41132f84",
"Refresh_token": "${refresh_token}"
},
"httpHeaders": {
"Content-Type": "application/json"
},
"httpContentType": "application/json"
},
"testConnectionParams": {
"http": {
"url": "https://removed/api/notification/internal-integration/get-list-of-roles",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"successResponses": {
"isSuccessful": true
},
"unsuccessResponses": {
"isSuccessful": false
},
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error"
}
}
}
}
[This message has been edited by moderator to mask url]
05/07/2024 05:17 AM
Hi @rushikeshvartak ,
Do you have any approach to debug this further?
Regards,
Jagadeesh
05/07/2024 05:57 AM
Can you share logs