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

Access token is not getting regenerated by REST connector

Sankar
New Contributor
New Contributor

Hi All,

I am using REST connector for an application integration. I am using the below connection Json and it is working when I pasted to connection JSON parameter under connection. 

After the token is expired, I could see the below error in logs.

++++++++++++++++++

2024-06-21T11:52:55.669+00:00 ecm-worker rest.RestUtilService quartzScheduler_Worker-9-5xdm2 DEBUG Got showLogs = true
2024-06-21T11:52:55.669+00:00 ecm-worker rest.RestProvisioningService quartzScheduler_Worker-9-5xdm2 DEBUG Calling Webservice Url - https://api.walkme.com/public/v1/scim/Users/  with httpParams - [userName:sugandha.varma@removed.com, externalId:sugandha.varma@removed.com, name:[familyName:Sugandha, givenName:Varma], password=******
2024-06-21T11:52:55.669+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG calling executeRequestWithTimeoutConfig for api...
2024-06-21T11:52:55.669+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG Enter getTimeOutConfig
2024-06-21T11:52:55.670+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG connectionType: REST
2024-06-21T11:52:55.670+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG connectionTimeoutConfig before guardRail validation: null
2024-06-21T11:52:55.670+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG INFO: connectionTimeoutConfig is null, setting it to default value
2024-06-21T11:52:55.670+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG Final connectionTimeoutConfig after guardRail validation: [connectionTimeout:10, writeTimeout:60]
2024-06-21T11:52:55.670+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG calling api...
2024-06-21T11:52:55.670+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG before calling executeRequestWithHeaders for api...
2024-06-21T11:52:55.670+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG isFipsEnabled = false
2024-06-21T11:52:55.670+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG getHttpClient - proxyParams : null
2024-06-21T11:52:55.670+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG getHttpClient - sslSocketFactory : null
2024-06-21T11:52:55.676+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG setting connection timeout to 10 seconds and request timeout to 60 seconds
2024-06-21T11:52:55.677+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG getHttpClient - HttpClientBuilder.create().build() called.
2024-06-21T11:52:55.972+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG called executePostRequestWithHeaders for api...
2024-06-21T11:52:55.972+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG after calling executeRequestWithHeaders for api...
2024-06-21T11:52:55.972+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG called api...
2024-06-21T11:52:55.972+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG timeout validated for api...
2024-06-21T11:52:55.972+00:00 ecm-worker services.HttpClientUtilityService quartzScheduler_Worker-9-5xdm2 DEBUG got response for api...
2024-06-21T11:52:55.972+00:00 ecm-worker rest.RestUtilService quartzScheduler_Worker-9-5xdm2 DEBUG Got showLogs = true
2024-06-21T11:52:55.972+00:00 ecm-worker rest.RestProvisioningService quartzScheduler_Worker-9-5xdm2 DEBUG Got Webservice API Response: [headers:[Content-Type: application/json; charset=utf-8, Content-Length: 23, Vary: Origin, X-Kong-Response-Latency: 1, Date: Fri, 21 Jun 2024 11:52:55 GMT, Connection: close, Content-Security-Policy: default-src 'none', X-Frame-Options: DENY, X-Content-Type-Options: nosniff, X-XSS-Protection: 1; mode=block, Strict-Transport-Security: max-age=31536000;preload], responseText:{exp":"token expired"} cookies:[] statusCode:401]"
2024-06-21T11:52:55.972+00:00 ecm-worker rest.RestUtilService quartzScheduler_Worker-9-5xdm2 DEBUG pullObjectsByRest - responseStatusCode ::401
2024-06-21T11:52:55.972+00:00 ecm-worker rest.RestProvisioningService quartzScheduler_Worker-9-5xdm2 ERROR Exception in pullObjectsByRest :401
2024-06-21T11:52:55.972+00:00 ecm-worker rest.RestProvisioningService quartzScheduler_Worker-9-5xdm2 ERROR Inside token Expiry Exception block. connectionParamMap.refreshTryCount : 0
2024-06-21T11:52:55.972+00:00 ecm-worker rest.RestProvisioningService quartzScheduler_Worker-9-5xdm2 DEBUG Incrementing connectionParamMap.refreshTryCount : 1
2024-06-21T11:52:55.972+00:00 ecm-worker rest.RestProvisioningService quartzScheduler_Worker-9-5xdm2 DEBUG maxRefreshTryCount : 5
2024-06-21T11:52:55.972+00:00 ecm-worker rest.RestProvisioningService quartzScheduler_Worker-9-5xdm2 DEBUG Inside populateHttpParamsForBasicWithAccessToken ....
2024-06-21T11:52:55.974+00:00 ecm-worker rest.RestProvisioningService quartzScheduler_Worker-9-5xdm2 ERROR Exception in populateHttpParamsForBasicWithAccessToken

++++++++++++++++++

Once I saw this message, I pasting the same Json to connectionJson parameters.

And again it is working.

Automatically the token is not getting automatically.

Can you please help me with this.

+++++++++++++++++++++++++++++++++++

{
"authentications":{
"acctAuth":{
"authType":"basicWithAccessToken",
"authError":[
"InvalidAuthenticationToken",
"AuthenticationFailed",
"FAILURE",
"INVALID_SESSION_ID"
],
"properties":{
"userName":"XXXXXXXXXXXXXXXXX",
"password":"XXXXXXXXXXXXXXXXXX"
},
"url":"https://XXXXXXXXXXXXXXX/accounts/connect/token",
"httpMethod":"POST",
"httpContentType":"application/x-www-form-urlencoded",
"errorPath":"error.code",
"maxRefreshTryCount":5,
"tokenResponsePath":"access_token",
"tokenType":"Bearer",
"accessToken":"Bearer XXXXXXXXXXXXXXXXXXXXX",
"retryFailureStatusCode":[
401,
403,
500
]
}
}
}

+++++++++++++++++++++++++++++++++++

Postman Response:

Sankar_0-1719940952727.png

Thanks,

Sankar

[This message has been edited by moderator to mask sensitive information]

4 REPLIES 4

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 you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Sankar
New Contributor
New Contributor

Hi @rushikeshvartak ,

Please find the Postman screenshot in the above. Also please find curl command from postman.

+++++++++++++++++++++

curl --location 'https://XXXXXXXXXX/accounts/connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
--data-urlencode 'grant_type=client_credentials'

+++++++++++++++++++++

Thanks,

Sankar.

"accessToken":"Basic XXXXXXXXXXXXXXXXXXXXX",

And xxx will be username:password in base 64 encoded

refer https://docs.saviyntcloud.com/bundle/REST-v24x/page/Content/Examples-for-JSON-Construction.htm


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

HI @rushikeshvartak ,

Yes. XXX is the combination of username and password.

We are using the username and password in credentials and when we are clicking send button the username and password will be encrypted and it s going in header as Authorization.

Can you please let me what should try from my end.

Thanks,

Sankar.