SweetConnect LogoSweetConnect

Renewing the Access Token

Access token are typically short-lived. When an access token expires, you can renew it using a refresh token. To do this, send another POST request to the same token endpoint with these parameters:

  • grant_type: set to refresh_token to specify that you are using a refresh token to obtain new access token
  • client_id: the same client identifier (i.e. sweetconnect)
  • refresh_token: the refresh token you received during the initial token request
  • scope: again, set to openid
curl -X POST --location "https://iam.my.sweetconnect.io/realms/sweetconnect-prod/protocol/openid-connect/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=refresh_token&client_id=sweetconnect&refresh_token=${REFRESH_TOKEN}&scope=openid"

This request will return a new access token and a new refresh token that you can then use to authenticate further API calls.