Refresh Tokens

To obtain refresh token and then to get a refreshed access_token follow these steps:

  1. At the beginning of authorization step of client in scope add "offline_access". i.e 
    1. https://identity.justgiving.com/connect/authorize?client_id=[clientid]&response_type=code&scope=openid+profile+email+account+fundraise+offline_access&redirect_uri=[url]&nonce=ba3c9a58dff94a86aa633e71e6afc4e3

  2. When you obtain code from previous call you can call
    1. POST: /connect/token
      HOST: https://identity.justgiving.com
      Authorization: Basic {yourBase64EncodedCredentials}
      Encoded form parameters :
      1. grant_type = authorization_code
      2. code = code_from_previous_call
      3. redirect_uri = redirects_uri

    2. Response should be :

      "{\"id_token\":\"Very long token\",\"access_token\":\"access token to use for api call\",\"expires_in\":3600,\"token_type\":\"Bearer\",\"refresh_token\":\"refresh token required for next call\"}"

  3.  Now if you have refresh_token you can call :
    1. POST: /connect/token
      HOST: https://identity.justgiving.com
      Authorization: Basic {yourBase64EncodedCredentials}
      Encoded form parameters :
      1. grant_type = refresh_token
      2. refresh_token = token from previous call
      3. redirect_uri = redirect uri

    2. Response should be :
      "{\"access_token\":\"new access token to use for consequent api calls\",\"expires_in\":3600,\"token_type\":\"Bearer\",\"refresh_token\":\"new refresh token to be used when next refreshing the token\"}"

Refresh tokens last 30 days. 

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.