liveBook · Manning

Token endpoint

As explained in Software Security for Developers

A token endpoint is an OAuth endpoint that accepts an authorization grant and issues access tokens or other tokens.

A token endpoint is an OAuth endpoint that accepts an authorization grant and issues tokens, such as an access token or ID token. It forms the server-side exchange after a user has authenticated and an authorization code has been returned. section 12.3

A typical authorization-code exchange proceeds as follows:

  • Discover the endpoint from the OpenID configuration document. section 12.3
  • Obtain an authorization code through the authorization endpoint. section 12.3
  • Send the code, redirect URI, grant type, and client credentials to the token endpoint. section 12.3
  • Receive an access token, token type, expiration, scope, and possibly an ID token. section 12.3

Exchanging an authorization code

A client posts form data to /oauth2/token with grant_type=authorization_code, the returned code, redirect_uri, and client_id, authenticating with Basic credentials. The response contains a Bearer access token with a five-minute lifetime and an ID token. section 12.3

{
  "issuer": "http://localhost:9000",
  "authorization_endpoint": "http://localhost:9000/oauth2/authorize",  #1
  "device_authorization_endpoint": 
  "http://localhost:9000/oauth2/device_authorization",
  "token_endpoint": "http://localhost:9000/oauth2/token",  #2

…

}

Inspect the OIDC configuration to find the authorization and token endpoint URLs before making requests. section 12.3

How Software Security for Developers covers it

How deep it goes
Demonstrates endpoint discovery, browser authorization, cURL exchange, and response inspection without detailing server internals.
Examples
Uses localhost endpoint discovery, a browser authorization request, a returned code, a cURL token request, and a JSON token response.
What it assumes
Assumes a configured OIDC identity provider and client while demonstrating the exchange steps from endpoint discovery.
What you can do after
Operate a token endpoint through a documented authorization-code request and interpret its token response.
How it connects
Connects authorization endpoints, authorization codes, OAuth 2.0, OpenID Connect, access tokens, and ID tokens.

Also explained in

Compare how 3 books explain token endpoint →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.