OAuth

Obtain access token

OAuth2 token endpoint. Exchanges an authorization code for an access token.

post/api/token

Request

  • Base URL
    https://lichess.org
  • URL
    https://lichess.org/api/token
  • Auth
    none required

Request body application/x-www-form-urlencoded

grant_type'authorization_code'
codestring

The authorization code that was sent in the code parameter to your redirect_uri.

code_verifierstring

A code_challenge was used to request the authorization code. This must be the code_verifier it was derived from.

redirect_uristring

Must match the redirect_uri used to request the authorization code.

client_idstring

Must match the client_id used to request the authorization code.

Example request

{
  "grant_type": "authorization_code",
  "code": "liu_iS1uOZg99Htmo58ex2jKgYziUfzsnAl0",
  "code_verifier": "Ry1rbGdOMTQtUjhOc0lmTnFKak1LTHV0NjlRMll2aXYtTThkQnlJRkRpaGwyQjh0ZDNFdzFPSG9KUlY4M1NrRzJ5ZHhUdjVZR08zLTZOT3dCN2xLfjZOXzU2WHk4SENP",
  "redirect_uri": "http://example.com/",
  "client_id": "example.com"
}

Response

Access token successfully obtained.

token_typestring required
access_tokenstring required
expires_ininteger required

Changes

No recorded changes to this operation across all 16 revisions of this API.