OAuth2 token exchange.
POST
application/x-www-form-urlencoded- body
client_id?stringClient ID, required if grant_type=authorization_code
client_secret?stringClient secret, required if grant_type=authorization_code and the client is confidential. Public clients (token_endpoint_auth_method=none) send no secret.
code?stringAuthorization code, required if grant_type=authorization_code
code_verifier?stringPKCE code verifier, required if grant_type=authorization_code. 43-128 characters per RFC 7636.
refresh_token?stringRefresh token, required if grant_type=refresh_token
grant_type*stringGrant type
Value in
"authorization_code""refresh_token""password""client_credentials""implicit"OK
application/json- response
access_token?stringexpires_in?integerexpiry?stringExpiry is not part of RFC 6749 but is included for compatibility with golang.org/x/oauth2.Token and clients that expect a timestamp.
Format
date-timerefresh_token?stringscope?stringtoken_type?codersdk.OAuth2TokenTypeValue in
"Bearer""DPoP"The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X POST \ "$CODER_URL/oauth2/tokens" \ -H "Content-Type: application/x-www-form-urlencoded" \ --data-binary "@{file}"Example Response
{ "access_token": "string", "expires_in": 0, "expiry": "2019-08-24T14:15:22Z", "refresh_token": "string", "scope": "string", "token_type": "Bearer"}