Refreshing Access Token

Our Access Token expires every 2 hours, so you will need to refresh it before it expires.

Refreshing is straightforward. You will need to call one API (see Implementation page for URLs).

const refreshToken = 'PGFanyIh-GUKReZ5P1LlAsUJzBR76BQI5SJlIX4-aHQ'
const tokenUrl = 'http://api-sandbox.edgetag.io/v1/oauth-app/client/token'

const body = new URLSearchParams({
  refresh_token: refreshToken,
  grant_type: 'refresh_token',
})

const response = await fetch(tokenUrl, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
    Authorization: `Basic ${btoa(clientId + ':' + clientSecret)}`,
  },
  body
})

The API is the same as for code exchange; only the parameters differ slightly.

Request is GET . If the request is successful, you will get the following response:

Last updated

Was this helpful?