Exchange a code or refresh token
https://tokens.livepush.io/oauth2/access_token
Base URL https://tokens.livepush.io — Authentication & OAuth 2.0
Exchanges an authorization code for an access and refresh token pair, or rotates an existing refresh token. Access tokens are valid for 14 days.
Refresh tokens are single use — the supplied one is disabled as soon as a new pair is issued, so store the new refresh_token from every response.
Call this server-side only. It is a GET and takes client_secret as a query parameter, so the secret lands in proxy logs, browser history and access logs if it is ever called from a client. Make sure your own logging redacts it.
Authorization
This endpoint does not require authentication.
Try it
Loading the request builder…
GET
https://tokens.livepush.io/oauth2/access_token
— This call only reads data.
Parameters
Query parameters
-
grant_typestring requiredUseauthorization_codefor a fresh grant, orrefresh_tokento rotate an existing one.authorization_coderefresh_tokenexample: authorization_code -
codestring requiredThe grant code, or — whengrant_typeisrefresh_token— the refresh token. Both are passed in this same parameter. -
client_idstring requiredClient ID issued by the developer console. -
client_secretstring requiredClient secret. Server-side only. -
redirect_uristring requiredMust match the value the code was issued against.example: https://yourapp.example.com/callback
Code samples
curl -X GET 'https://tokens.livepush.io/oauth2/access_token?grant_type=authorization_code&code=%3Ccode%3E&client_id=%3Cclient_id%3E&client_secret=%3Cclient_secret%3E&redirect_uri=https%3A%2F%2Fyourapp.example.com%2Fcallback'
const response = await fetch('https://tokens.livepush.io/oauth2/access_token?grant_type=authorization_code&code=%3Ccode%3E&client_id=%3Cclient_id%3E&client_secret=%3Cclient_secret%3E&redirect_uri=https%3A%2F%2Fyourapp.example.com%2Fcallback', {
method: 'GET',
});
if (!response.ok) {
throw new Error(`Livepush API error ${response.status}`);
}
const data = await response.json();
import requests
response = requests.get('https://tokens.livepush.io/oauth2/access_token?grant_type=authorization_code&code=%3Ccode%3E&client_id=%3Cclient_id%3E&client_secret=%3Cclient_secret%3E&redirect_uri=https%3A%2F%2Fyourapp.example.com%2Fcallback', timeout=30)
response.raise_for_status()
data = response.json()
Responses
A new token pair.
-
access_tokenstringJWT to send asAuthorization: Bearer <access_token>. -
refresh_tokenstringOpaque token for obtaining the next pair. -
token_typestringAlways the literalaccess_token. Non-standard — send the header asAuthorization: Bearer …regardless of this value. -
expires_inintegerAccess token lifetime in seconds. 14 days.
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
"refresh_token": "V1StGXR8_Z5jdHi6B-myT…",
"token_type": "access_token",
"expires_in": 1209600
}
The exchange failed.
-
errorstringinvalid_requestinvalid_clientinvalid_grantexpired_grantunsupported_response_typeunsupported_grant_typeinvalid_scopeaccess_deniedserver_error -
error_descriptionstring
{
"error": "invalid_client",
"error_description": "could not identify provided \"client_id\""
}