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

BasicWithAccessToken - Token not refreshing

shreyascn
New Contributor III
New Contributor III
{
  "authentications": {
    "acctAuth": {
      "authType": "BasicWithAccessToken",
      "url": "https://XXXX/oauth2/token",
      "httpMethod": "POST",
      "httpHeaders": {"Accept": "application/json"},
      "properties": {"username": "XX","password":"XXX"},
      "httpContentType": "application/x-www-form-urlencoded",
	  "httpParams": {
        "grant_type": "client_credentials",
        "client_secret": "XXX",
        "client_id": "XXXX"
      },
      "expiryError": "Invalid token.",
      "retryFailureStatusCode": [403,401,500],
      "authError": [
        "InvalidAuthenticationToken",
        "AuthenticationFailed",
        "Authentication_MissingOrMalformed",
        "Invalid token."
      ],
      "timeOutError": "Read timed out",
      "errorPath": "",
      "maxRefreshTryCount": 5,
      "tokenResponsePath": "access_token",
      "tokenType": "Bearer",
      "accessToken": "Bearer eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNyc2Etc2hhMjU2IiwidHlwIjoiSldUIn0.eyJyaWQiOiJhamF5ZW5kYXIucmVkZHlAYWNjZW50dXJlLmNvbSIsImV4cCI6MTY5MDgwMjUwNiwiaXNzIjoiUmFwaWRSZXNwb25zZSIsImlhdCI6MTY5MDc5ODkwNiwibmJmIjoxNjkwNzk4OTA2fQ.g5MLUgsLKkkDwZfVnKg61mGtyLZQ1aPjoeuXuezm8WJwb6japoc4UwqLeiBUKVUcukF99kl6UdDWK61qCO1amX7QgCUXuCHwsBmnV9YhVkrRxOVuupXO3iFhtiLHWh03NR__V5Wl55RbTRV4s6ntjSEahHhYvW2opeC5O58wyuEQrbMoqbjrmCDm9hoiJO1tQfg52J3w5t3g7VZ2fCEUW5E4YIFdOlnO-Z7uNFywtCu7IVbgckDu3-xGEg3mVFyPtLOgBIa2-4dfUY-sFrUvFYNuG_Hkp2mOFZ0yDrDYfZzSCyxbuEEo0MNSSiDKGhMbNbZnYrV8Wz_9k6d2E5s9sss"
    }
  }
}

Hello All, 

Using the below Connection JSON, however the token doesnt get refreshed after expiry, If I hard code the token in the connection JSON under accessToken it works. 

 

{
  "authentications": {
    "acctAuth": {
      "authType": "BasicWithAccessToken",
      "url": "https://XXXX/oauth2/token",
      "httpMethod": "POST",
      "httpHeaders": {"Accept": "application/json"},
      "properties": {"username": "XX","password":"XXX"},
      "httpContentType": "application/x-www-form-urlencoded",
      "expiryError": "Invalid token.",
      "retryFailureStatusCode": [403,401,500],
      "authError": [
        "InvalidAuthenticationToken",
        "AuthenticationFailed",
        "Authentication_MissingOrMalformed",
        "Invalid token."
      ],
      "timeOutError": "Read timed out",
      "errorPath": "",
      "maxRefreshTryCount": 5,
      "tokenResponsePath": "access_token",
      "tokenType": "Bearer",
      "accessToken": "Bearer eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNyc2Etc2hhMjU2IiwidHlwIjoiSldUIn0.eyJyaWQiOiJhamF5ZW5kYXIucmVkZHlAYWNjZW50dXJlLmNvbSIsImV4cCI6MTY5MDgwMjUwNiwiaXNzIjoiUmFwaWRSZXNwb25zZSIsImlhdCI6MTY5MDc5ODkwNiwibmJmIjoxNjkwNzk4OTA2fQ.g5MLUgsLKkkDwZfVnKg61mGtyLZQ1aPjoeuXuezm8WJwb6japoc4UwqLeiBUKVUcukF99kl6UdDWK61qCO1amX7QgCUXuCHwsBmnV9YhVkrRxOVuupXO3iFhtiLHWh03NR__V5Wl55RbTRV4s6ntjSEahHhYvW2opeC5O58wyuEQrbMoqbjrmCDm9hoiJO1tQfg52J3w5t3g7VZ2fCEUW5E4YIFdOlnO-Z7uNFywtCu7IVbgckDu3-xGEg3mVFyPtLOgBIa2-4dfUY-sFrUvFYNuG_Hkp2mOFZ0yDrDYfZzSCyxbuEEo0MNSSiDKGhMbNbZnYrV8Wz_9k6d2E5s9sss"
    }
  }
}

 

Error from Create accnt postman when token is expired - 

shreyascn_0-1690802560461.png

Token Succes Response - 

shreyascn_1-1690802732831.png

 


Debug logs: 

 

11:10:20 GMT, Connection: close, Vary: Accept-Encoding], responseText:{"Message":"Invalid token."}, cookies:[], statusCode:401]
2023-07-31 11:10:20,929 [quartzScheduler_Worker-4] DEBUG rest.RestUtilService  - pullObjectsByRest - responseStatusCode ::401
2023-07-31 11:10:20,929 [quartzScheduler_Worker-4] ERROR rest.RestProvisioningService  - Exception in pullObjectsByRest :401
2023-07-31 11:10:20,929 [quartzScheduler_Worker-4] ERROR rest.RestProvisioningService  - Inside token Expiry Exception block. connectionParamMap.refreshTryCount : 5
2023-07-31 11:10:20,929 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - Incrementing connectionParamMap.refreshTryCount : 6
2023-07-31 11:10:20,929 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - maxRefreshTryCount : 5
2023-07-31 11:10:20,929 [quartzScheduler_Worker-4] ERROR rest.RestProvisioningService  - Exception in token refresh : null
2023-07-31 11:10:20,929 [quartzScheduler_Worker-4] ERROR rest.RestProvisioningService  - Error WebService call failed After retrying 5 times with responseStatusCode-null, Failed url-XXXXX, Error Message - null
2023-07-31 11:10:20,929 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - Decrementing connectionParamMap.refreshTryCount : 5
2023-07-31 11:10:20,932 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - Decrementing connectionParamMap.refreshTryCount : 4
2023-07-31 11:10:20,935 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - Decrementing connectionParamMap.refreshTryCount : 3
2023-07-31 11:10:20,937 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - Decrementing connectionParamMap.refreshTryCount : 2
2023-07-31 11:10:20,940 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - Decrementing connectionParamMap.refreshTryCount : 1
2023-07-31 11:10:20,943 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - Decrementing connectionParamMap.refreshTryCount : 0
2023-07-31 11:10:20,945 [quartzScheduler_Worker-4] ERROR rest.RestProvisioningService  - Call response: null
2023-07-31 11:10:20,945 [quartzScheduler_Worker-4] ERROR rest.RestProvisioningService  - callResponseMap: [:]
2023-07-31 11:10:20,945 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - showResponse: true
2023-07-31 11:10:20,946 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - createNewUser - temp.status - Failed
2023-07-31 11:10:20,946 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - doBreak: true
2023-07-31 11:10:20,946 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService  - response: [auditDetails:[call1:[[headers:null, message:, statusCode:null, description:null, status:Failed], [headers:null, message:, statusCode:null, description:null, status:Failed]]], cal

 



4 REPLIES 4

pmahalle
All-Star
All-Star

Hi @shreyascn ,

Can you try with below httpContentType once.

  "httpContentType": "application/json",

 Also what's content-type you are passing in header while generating token in postman?


Pandharinath Mahalle(Paddy)
If this reply answered your question, please Accept As Solution to help other who may have a same problem. Give Kudos 🙂

shreyascn
New Contributor III
New Contributor III

Hello @pmahalle 

In the auto generated header , it is , application/x-www-form-urlencoded. 
However I dont think there is a need to pass specific header given in postman we are not passing it and it still generates the token 

@shreyascn Can you share the full screenshot of the body you are using in postman.


Pandharinath Mahalle(Paddy)
If this reply answered your question, please Accept As Solution to help other who may have a same problem. Give Kudos 🙂

shreyascn
New Contributor III
New Contributor III

shreyascn_0-1690809146258.pngshreyascn_1-1690809219014.png