Click HERE to see how Saviynt Intelligence is transforming the industry. |
09/13/2024 01:58 AM
Hi team,
having some issues trying to get a new access token from an OAUTH password grant based connection.
getting this error in the logs, which is consistent with token expired:
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rd7xg-DEBUG-Got Webservice API Response: [headers:[Date: Fri, 13 Sep 2024 08:18:55 GMT, Set-Cookie=******/; expires=Sat, 13-Sep-2025 08:18:55 GMT; Max-Age=31536000; secure, Set-Cookie=******/; expires=Sat, 13-Sep-2025 08:18:55 GMT; Max-Age=31536000; secure, Strict-Transport-Security: max-age=63072000; includeSubDomains, X-Content-Type-Options: nosniff, X-Robots-Tag: none, Cache-Control: no-cache,must-revalidate,max-age=0,no-store,private, Set-Cookie=******/; expires=Sat, 13-Sep-2025 08:18:55 GMT; Max-Age=31536000; secure; SameSite=None, WWW-Authenticate: Token, Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked], responseText:[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}], cookies:[CookieConsentPolicy=0:1; path=/; expires=Sat, 13-Sep-2025 08:18:55 GMT; Max-Age=31536000; secure, LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Sat, 13-Sep-2025 08:18:55 GMT; Max-Age=31536000; secure, BrowserId=0ca243GoEe-zJss2HpudHw; domain=.salesforce.com; path=/; expires=Sat, 13-Sep-2025 08:18:55 GMT; Max-Age=31536000; secure; SameSite=None], statusCode:401]
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-6-rd7xg-DEBUG-pullObjectsByRest - responseStatusCode ::401
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rd7xg-ERROR-Exception in pullObjectsByRest :401
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rd7xg-ERROR-Inside token Expiry Exception block. connectionParamMap.refreshTryCount : 1
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rd7xg-DEBUG-Incrementing connectionParamMap.refreshTryCount : 2
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rd7xg-DEBUG-maxRefreshTryCount : 5
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-6-rd7xg-DEBUG-Calling https://test/services/oauth2/token
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-calling executeRequestWithTimeoutConfig for api...
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-calling api...
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-before calling executeRequestWithHeaders for api...
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-isFipsEnabled = false
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-getHttpClient - proxyParams : null
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-getHttpClient - sslSocketFactory : null
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-setting connection timeout to 10 seconds and request timeout to 60 seconds
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-getHttpClient - HttpClientBuilder.create().build() called.
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-called executePostRequestWithHeaders for api...
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-after calling executeRequestWithHeaders for api...
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-called api...
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-timeout validated for api...
2024-09-13T05:18:55-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-got response for api...
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-6-rd7xg-DEBUG-fetching result from response.responseText
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-6-rd7xg-DEBUG-responseToken is null or empty
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-6-rd7xg-DEBUG-connectionid:: null
2024-09-13T05:18:55-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rd7xg-DEBUG-access token populated for oauth authentication..
2024-09-13T05:18:56-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rd7xg-DEBUG-parsing original httpParams after binding
2024-09-13T05:18:56-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rd7xg-DEBUG-Inside pullObjectsByRest
2024-09-13T05:18:56-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-6-rd7xg-DEBUG-Got showLogs = true
2024-09-13T05:18:56-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-6-rd7xg-DEBUG-Calling Webservice Url - https://test/services/data/v60.0/sobjects/User with httpParams - [Alias:${if(user?.lastname!=null && user?.lastname.length()>=4){user?.firstname.toLowerCase().substring(0,1)+user?.lastname.toLowerCase().substring(0,4)}else if(user?.lastname!=null && user?.lastname?.length()<4){user?.firstname.toLowerCase().substring(0,1)+user?.lastname.toLowerCase()}}, IsActive:true, Username:${user.email+'.renprod'}, Email:${user.email}, FirstName:${user.firstname}, LastName:${user.lastname}, CommunityNickname:${user.displayname}, EmailEncodingKey:ISO-8859-1, TimeZoneSidKey:America/New_York, LocaleSidKey:en_US, LanguageLocaleKey:en_US, Business__c:${requestAccessAttributes.get('Business')}, Function__c:${requestAccessAttributes.get('Function')}, GE_REN_Region__c:${requestAccessAttributes.get('Region')}, Country:${user.country}, Phone:${user.phonenumber}, City:${user.city}, State:${user.state}, Title:${user.title}, Department:${user.DepartmentName}, UserRoleId:00E41000000Q5Jg, ProfileId:00e41000000FegwAAC, FederationIdentifier:${user.username}]
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-calling executeRequestWithTimeoutConfig for api...
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-calling api...
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-before calling executeRequestWithHeaders for api...
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-isFipsEnabled = false
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-getHttpClient - proxyParams : null
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-getHttpClient - sslSocketFactory : null
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-setting connection timeout to 10 seconds and request timeout to 60 seconds
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-getHttpClient - HttpClientBuilder.create().build() called.
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-called executePostRequestWithHeaders for api...
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-after calling executeRequestWithHeaders for api...
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-called api...
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-timeout validated for api...
2024-09-13T05:18:56-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-6-rd7xg-DEBUG-got response for api...
2024-09-13T05:18:56-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-6-rd7xg-DEBUG-Got showLogs = true
this is the ConnectionJSON
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://test/services/oauth2/token",
"httpMethod": "POST",
"httpParams": {
"grant_type": "password",
"client_secret": "####",
"username": "####",
"client_ID": "####",
"password": "####"
},
"httpHeaders": {
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "INVALID_SESSION_ID",
"authError": [
"AuthenticationFailed",
"Session expired or invalid",
"INVALID_SESSION_ID",
"invalid_grant",
"InvalidAuthenticationToken",
"AuthenticationFailed",
"authentication failure"
],
"timeOutError": "Read timed out",
"authHeaderName": "Authorization",
"errorPath": "errorCode",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"retryFailureStatusCode": [
401,
400
],
"accessToken": "Bearer abcd"
}
}
}
This is succesfull Postman request to get an access token:
curl --location 'https://test/services/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Cookie: BrowserId=Knu-cg1CEe-o7eeWSBO8YA; CookieConsentPolicy=0:1; LSKey-c$CookieConsentPolicy=0:1' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'client_id=####' \
--data-urlencode 'client_secret=####' \
--data-urlencode 'username=####' \
--data-urlencode 'password=####'
this is CreateAccountJSON
{
"accountIdPath": "call1.message.id",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"responseColsToPropsMap": {
"status": "#CONST#1~#~char"
},
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://test/services/data/v60.0/sobjects/User",
"httpMethod": "POST",
"httpParams": "{\"Alias\":\"${if(user?.lastname!=null && user?.lastname.length()>=4){user?.firstname.toLowerCase().substring(0,1)+user?.lastname.toLowerCase().substring(0,4)}else if(user?.lastname!=null && user?.lastname?.length()<4){user?.firstname.toLowerCase().substring(0,1)+user?.lastname.toLowerCase()}}\",\"IsActive\":true,\"Username\":\"${user.email+'.renprod'}\",\"Email\":\"${user.email}\",\"FirstName\":\"${user.firstname}\",\"LastName\":\"${user.lastname}\",\"CommunityNickname\":\"${user.displayname}\",\"EmailEncodingKey\":\"ISO-8859-1\",\"TimeZoneSidKey\":\"America/New_York\",\"LocaleSidKey\":\"en_US\",\"LanguageLocaleKey\":\"en_US\",\"Business__c\":\"${requestAccessAttributes.get('Business')}\",\"Function__c\":\"${requestAccessAttributes.get('Function')}\",\"GE_REN_Region__c\":\"${requestAccessAttributes.get('Region')}\",\"Country\":\"${user.country}\",\"Phone\":\"${user.phonenumber}\",\"City\":\"${user.city}\",\"State\":\"${user.state}\",\"Title\":\"${user.title}\",\"Department\":\"${user.DepartmentName}\",\"UserRoleId\":\"00E41000000Q5Jg\",\"ProfileId\":\"00e41000000FegwAAC\",\"FederationIdentifier\":\"${user.username}\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
201
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
404,
405,
500
]
}
}
]
}
Thanks
09/13/2024 06:46 AM
Does hardcoded json works in create account json ?
09/14/2024 10:28 PM
Hi @wronzitti as per logs it is not able to extract the access token from the call response.
Build a new connection json and see feed itni the system to check if you are getting the right response.
09/16/2024 04:35 AM
Hi, thanks for your responses.
I tried to hardcoded the binding variables, with same result.
I also recreated the connectionjson, but still getting the same error in the logs.
this is the connection being used. Is there something wrong with this, giving the Postman succesfull request in my previous post?
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://test/services/oauth2/token",
"httpMethod": "POST",
"httpParams": {
"grant_type": "password",
"client_secret": "####",
"username": "####",
"client_ID": "#####",
"password": "####"
},
"httpHeaders": {
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "INVALID_SESSION_ID",
"authError": [
"AuthenticationFailed",
"Session expired or invalid",
"INVALID_SESSION_ID",
"invalid_grant",
"InvalidAuthenticationToken",
"AuthenticationFailed",
"authentication failure"
],
"timeOutError": "Read timed out",
"authHeaderName": "Authorization",
"errorPath": "errorCode",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"retryFailureStatusCode": [
401,
400
],
"accessToken": "Bearer 00D3K0000000oFn!AQYAQ"
}
}
}
These are the logs
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-rd7xg-DEBUG-Got Webservice API Response: [headers:[Date: Mon, 16 Sep 2024 11:23:32 GMT, Set-Cookie=******/; expires=Tue, 16-Sep-2025 11:23:32 GMT; Max-Age=31536000; secure, Set-Cookie=******/; expires=Tue, 16-Sep-2025 11:23:32 GMT; Max-Age=31536000; secure, Strict-Transport-Security: max-age=63072000; includeSubDomains, X-Content-Type-Options: nosniff, X-Robots-Tag: none, Cache-Control: no-cache,must-revalidate,max-age=0,no-store,private, Set-Cookie=******/; expires=Tue, 16-Sep-2025 11:23:32 GMT; Max-Age=31536000; secure; SameSite=None, WWW-Authenticate: Token, Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked], responseText:[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}], cookies:[CookieConsentPolicy=0:1; path=/; expires=Tue, 16-Sep-2025 11:23:32 GMT; Max-Age=31536000; secure, LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 16-Sep-2025 11:23:32 GMT; Max-Age=31536000; secure, BrowserId=GysGXnQeEe-TN3moTcKYmw; domain=.salesforce.com; path=/; expires=Tue, 16-Sep-2025 11:23:32 GMT; Max-Age=31536000; secure; SameSite=None], statusCode:401]
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-4-rd7xg-DEBUG-pullObjectsByRest - responseStatusCode ::401
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-rd7xg-ERROR-Exception in pullObjectsByRest :401
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-rd7xg-ERROR-Inside token Expiry Exception block. connectionParamMap.refreshTryCount : 3
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-rd7xg-DEBUG-Incrementing connectionParamMap.refreshTryCount : 4
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-rd7xg-DEBUG-maxRefreshTryCount : 5
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-4-rd7xg-DEBUG-Calling https://geren--rendevfull.sandbox.my.salesforce.com/services/oauth2/token
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-calling executeRequestWithTimeoutConfig for api...
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-calling api...
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-before calling executeRequestWithHeaders for api...
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-isFipsEnabled = false
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-getHttpClient - proxyParams : null
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-getHttpClient - sslSocketFactory : null
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-setting connection timeout to 10 seconds and request timeout to 60 seconds
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-getHttpClient - HttpClientBuilder.create().build() called.
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-called executePostRequestWithHeaders for api...
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-after calling executeRequestWithHeaders for api...
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-called api...
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-timeout validated for api...
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-got response for api...
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-4-rd7xg-DEBUG-fetching result from response.responseText
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-4-rd7xg-DEBUG-responseToken is null or empty
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-4-rd7xg-DEBUG-connectionid:: null
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-rd7xg-DEBUG-access token populated for oauth authentication..
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-rd7xg-DEBUG-parsing original httpParams after binding
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-rd7xg-DEBUG-Inside pullObjectsByRest
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-4-rd7xg-DEBUG-Got showLogs = true
2024-09-16T08:23:32-03:00-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-rd7xg-DEBUG-Calling Webservice Url - https://test/services/data/v60.0/sobjects/User with httpParams - [Alias:dummy005, IsActive:true, Username:dummy005@ge.com.renprod, Email:dummy005@ge.com, FirstName:dummy005, LastName:Doe, CommunityNickname:dummy005, EmailEncodingKey:ISO-8859-1, TimeZoneSidKey:America/New_York, LocaleSidKey:en_US, LanguageLocaleKey:en_US, Business__c:Offshore Wind, Function__c:Product Line, GE_REN_Region__c:Asia, Country:US, Phone:1565184941, City:Buenos Aires, State:Buenos Aires, Title:IDM Developer, Department:GEV DT-Chief Information & Product Security Office, SVMXC__ServiceMax_User__c:false, GE_Is_CPQ_User__c:false, ProfileId:00e41000000FHjdAAG, UserRoleId:00E41000000Q5Jg, GE_REN_IDM_Role__c:Offshore Wind:Product Line:Asia, FederationIdentifier:503412371]
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-calling executeRequestWithTimeoutConfig for api...
2024-09-16T08:23:32-03:00-ecm-worker-services.HttpClientUtilityService-quartzScheduler_Worker-4-rd7xg-DEBUG-calling api...
09/16/2024 07:43 AM
Your postman curl show id is lower case
use client_id in json instead of client_ID