Refresh Token

Refresh Token Request Setup

Once you have acquired your initial access_token and refresh_token found in the API Upload Setup Instructions you will be able to use the access token for 15 minutes.
Once that time has gone, you must acquire a new access_token by using the previously acquired refresh_token, and the following POST request:

2092

Authorization


2096

Headers


2092

Body


The url for this POST request is: https://accounts.lightspeed.app/oauth/token


Below is the cURL code snippet for this request if you would rather import this into your test app:

curl -X POST \
  https://accounts.lightspeed.app/oauth/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Postman-Token: 30ef2f0b-445f-4e28-adfa-70995e1fef56' \
  -H 'cache-control: no-cache' \
  -d 'grant_type=refresh_token&refresh_token=YOUR_REFRESH_TOKEN'

If a successful POST has processed, you will be given a new access_token. Repeat this flow before every 15 minutes during your calls.

Automate your Access Token Variable

With the following Javascript, you can include this in your Tests section of your Test app and automate the Variable update of your Access token:

var jsonData = JSON.parse(responseBody);
access_token = jsonData.access_token
pm.environment.set("access_token", access_token);

What’s Next

Now that you've established your connection, lets move on to Ordering