Refresh an Expired User Access Token

When the current User Access Token has expired you will need to request a refreshed access token.

Required info:

  • Your API Key (use your Test API Key for testing)
  • Your current Refresh Token

Refresh token using cURL (Sandbox):

  • Replace placeholders <YOUR_SANDBOX_API_KEY>, <YOUR_SANDBOX_USER_ID>, and <YOUR_ACCOUNT_ID> with the credentials you would like to use.

    curl -X POST https://transactional-graph.staging.fluzapp.com/api/v1/graphql \
      -H "Authorization: Basic <YOUR_SANDBOX_API_KEY>" \
      -H "Content-Type: application/json" \
      -d '{
        "query": "mutation refreshUserAccessToken($refreshToken: String!) { refreshUserAccessToken(userId: $refreshToken) { accessToken refreshToken scopes } }",
        "variables": {
          "refreshToken": "<YOUR_REFRESH_TOKEND>"
        }
      }'
  • Response: You'll get a new access token that will include the same scopes as your previously issued token.

    {
      "data": {
        "generateUserAccessToken": {
          "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", // <-- This is new your Access Token
          "refreshToken": "0cb671d0b1aaa727c96874270cd15c2f",
    			"scopes": ["LIST_PURCHASES", ...]
        }
      }
    }
  • 💾 Copy theaccessToken value. You'll use this in the Authorization: Bearer <YOUR_USER_ACCESS_TOKEN> header for authenticated requests in the same manner as before.