API reference
Authentication
Access tokens and the OAuth 2.0 authorization-code flow
Every Livepush endpoint expects a JWT in the Authorization header. Tokens are issued by
the auth service at https://tokens.livepush.io through the OAuth 2.0 authorization-code
flow, and the three endpoints below are the whole of it.
The flow, step by step
- Register your app at the developer console.
You get a
client_id, aclient_secret, and a list of redirect URIs. A redirect URI sent later must match one of these exactly — there is no prefix matching. - Ask for consent. Call
GET /oauth2/authorizewith yourclient_id,redirect_uri,response_type=code, thescopelist you need, and a randomstate. It returns JSON describing the consent screen rather than rendering one, so you build the UI. ThesessionIDit returns lives for 5 minutes. - Send the decision back.
POST /oauth2/authorizewithsession_idandis_rejected. The response is a301to your redirect URI carrying eithercodeandstate, orerroranderror_description. Checkstatematches what you sent. - Exchange the code. Call
GET /oauth2/access_tokenwithgrant_type=authorization_code, thecode, yourclient_id,client_secretand the sameredirect_uri. You get anaccess_tokenvalid for 14 days and arefresh_token. The code is single-use and expires after 10 minutes. - Call the API. Send
Authorization: Bearer <access_token>on every request, whatevertoken_typesays. - Refresh before day 14. Same endpoint with
grant_type=refresh_token, passing the refresh token in thecodeparameter. Refresh tokens are single-use, so store the new one from every response.
The Authentication guide covers scopes, error codes and a shortcut for getting a token while you are just experimenting.
Endpoints
| Method | Path | Operation |
|---|---|---|
| GET | /oauth2/authorize |
Get the consent screen Starts the authorization-code flow and returns the data needed to render a consent screen. Unlike most OAuth servers thi |
| POST | /oauth2/authorize |
Submit the consent decision Records the user's decision and redirects back to your app. On approval the redirect carries code (valid for 10 minutes, |
| GET | /oauth2/access_token |
Exchange a code or refresh token Exchanges an authorization code for an access and refresh token pair, or rotates an existing refresh token. Access token |