Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Refresh both access_token and refresh_token

Testy
Regular Contributor
Regular Contributor

How can I configure the REST connector to refresh both the access token and refresh token in the ConnectionJSON?

{
"authentications": {
"userAuth": {
"authType": "oauth2",
"url": "https://example/oauth2/token",
"httpMethod": "POST",
"httpParams": {
"grant_type": "refresh_token",
"client_secret": "abcd",
"client_id": "abcd",
"refreshToken": "abcd"
},
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"InvalidAuthenticationToken",
"invalid_grant",
"invalid_target_scope"
],
"retryFailureStatusCode": [
401
],
"timeOutError": "Read timed out",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"accessToken": "Bearer abcd"
}
}
}

BillyMai_0-1715098272091.png

 



3 REPLIES 3

PremMahadikar
All-Star
All-Star

Hi @Testy ,

This documentation helps you to achieve it: https://docs.saviyntcloud.com/bundle/Dev-Handbook-REST-v24x/page/Content/Developers-Handbook.htmDeve...

Covers:

  1. Renew Access Token and Refresh Token using Single API
  2. Renew Access Token and Refresh Token using Different API

PremMahadikar_0-1715099097762.png

If this answers your questions, please consider selecting Accept As Solution and hit Kudos

Testy
Regular Contributor
Regular Contributor

can't access that link

Saathvik
All-Star
All-Star

@Testy : you may need to have partners account to access this link. Looks like it is not exposed to everyone.

For reference you can use below sample JSON 

Renew Access Token and Refresh Token using Single API

{
  "authentications": {
    "userAuth": {
      "authType": "oauth2",
      "url": "https://<domain name>/v1/access_token",
      "httpMethod": "POST",
      "httpParams": {
        "client_id": "<client ID>",
        "client_secret": "<client secret>",
        "grant_type": "refresh_token",
        "refresh_token": "${refresh_token}"
      },
      "httpHeaders": {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      "httpContentType": "application/x-www-form-urlencoded",
      "expiryError": "ExpiredAuthenticationToken",
      "authError": [
        "USER_AUTHENTICATION_FAILED",
        "PARTNER_AUTHENTICATION_FAILED",
        "AuthenticationFailed"
      ],
      "refreshType": "RefreshToken",
      "refreshTokenResponsePath": "refresh_token",
      "refreshToken": "<refresh token>",
      "timeOutError": "Read timed out",
      "errorPath": "errorCode",
      "maxRefreshTryCount": 5,
      "tokenResponsePath": "access_token",
      "tokenType": "Bearer",
      "retryFailureStatusCode": [
        401
      ],
      "accessToken": "Bearer <token>"
    }
  }
}

 Renew Access Token and Refresh Token using Different API:

{
  "authentications": {
    "userAuth": {
      "authType": "oauth2",
      "url": "https://<domain name>/oauth/token",
      "httpMethod": "POST",
      "httpParams": {
        "company_id": "<>",
        "client_id": "<>",
        "grant_type": "<>",
        "assertion": "${refresh_token}"
      },
      "httpHeaders": {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      "httpContentType": "application/x-www-form-urlencoded",
      "authError": [
        "Unable to authenticate the client",
        "Invalid OAuth token Bearer"
      ],
      "retryFailureStatusCode": [
        401
      ],
      "errorPath": "",
      "maxRefreshTryCount": 5,
      "tokenResponsePath": "access_token",
      "refreshType": "RefreshToken",
      "tokenType": "Bearer",
      "accessToken": "Bearer asdsdfghjk",
      "refreshToken": "<>",
      "refreshTokenAuthError": [
        "Unable to retrieve SAML assertion",
        "The provided SAML assertion is expired"
      ],
      "refreshTokenErrorPath": "errorMessage",
      "refreshTokenCall": {
        "refreshTokenResponsePath": "",
        "url": "https://<domain name>/oauth",
        "httpMethod": "POST",
        "httpParams": {
          "client_id": "<>",
          "user_id": "<>",
          "token_url": "https://<domain name>/oauth/token",
          "private_key": "<>"
        },
        "httpHeaders": {
          "Content-Type": "application/x-www-form-urlencoded"
        },
        "httpContentType": "application/x-www-form-urlencoded"
      }
    }
  }
}

 


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.