How to obtain a new access token when it has expired
Sandbox endpoint
https://api.platform.sandbox.easytranslate.com/oauth/token
In order to refresh your access token, you need to send a POST request.
The access token you are provided has an expiration date, once it has expired, you need to refresh the access token to be able to authenticate to the API.
In your request's header, you need to specify that json should be accepted. To do so, add "Accept" as a key and "application/json" as its value. You also need to specify the content-type, add "Content-Type" as a key and "application/x-www-form-urlencoded" as its value.
Finally, you need to pass the following data to the body of your request:
-
- client_id: {{CLIENT_ID}}
Your client ID can be found on the EasyTranslate platform in Settings > account > API
- client_id: {{CLIENT_ID}}
-
- client_secret: {{CLIENT_SECRET}}
The client secret is a secret token linked to your account, you can find it on the EasyTranslate platform in Settings > account > API. To display the secret token, simply click on the eye icon inside of the field. - grant_type: The grant_type value needs to be set to “refresh_token”
- refresh_token : {{REFRESH_TOKEN}}
You have received it in the response of your original access token request - scope : The scope value has to be set to “dashboard”
- client_secret: {{CLIENT_SECRET}}
Request example (Sandbox)
curl --location --request POST 'https://api.platform.sandbox.easytranslate.com/oauth/token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--form 'client_id="{{CLIENT_ID}}"' \
--form 'client_secret="{{CLIENT_SECRET}}"' \
--form 'grant_type="refresh_token"' \
--form 'refresh_token="{{REFRESH_TOKEN}}"' \
--form 'scope="dashboard"'
Response example
This is the data you would receive as a response:
{
"token_type": "Bearer",
"expires_in": 31622400,
"access_token": "{{ACCESS_TOKEN}}",
"refresh_token": "{{REFRESH_TOKEN}}"
}
-
- token_type: The token type here is “bearer”
- expires_in: You can see here until when the token is available
- access_token: This is the token you will be required to provide when you need to authenticate.
- refresh_token: You will need this token to refresh your access token once it has expired
The refresh access token can be used for 2 months.