Exchange an authorization code for tokens
POST
/api/v1/oidc/token
const url = 'https://gpu-kitchen.example.lan/api/v1/oidc/token';const options = { method: 'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded'}, body: new URLSearchParams({ grant_type: 'authorization_code', code: 'example', redirect_uri: 'example', code_verifier: 'example', client_id: 'example', client_secret: 'example' })};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gpu-kitchen.example.lan/api/v1/oidc/token \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data grant_type=authorization_code \ --data code=example \ --data redirect_uri=example \ --data code_verifier=example \ --data client_id=example \ --data client_secret=exampleThe OAuth 2.0 token endpoint, for the application’s server. A refusal answers the OAuth 2.0 error object { error, error_description }.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/x-www-form-urlencoded
object
grant_type
required
string
code
required
string
redirect_uri
required
string
code_verifier
string
client_id
string
client_secret
string
Responses
Section titled “Responses”Success.
Media typeapplication/json
object
access_token
required
string
token_type
required
string
expires_in
required
integer
id_token
required
string
scope
required
string
Example
{ "token_type": "Bearer"}Error codes: payload_too_large.
Media typeapplication/json
object
error
required
object
code
required
Stable snake_case code to branch on.
string
message
required
A sentence to show a person.
string
details
Optional structured context.
fix
Optional place where the problem is fixed.
string
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example", "fix": "example" }}