Exchange authorization code for tokens
Changed onOAuth 2.0 Token Endpoint (RFC 6749 Section 4.1.3).
Exchanges an authorization code, client credentials, refresh token, device code or service token for access tokens. Successful responses carry Cache-Control: no-store and Pragma: no-cache.
Grant Types:
- authorization_code: Exchange auth code for tokens (user-based)
- client_credentials: Get tokens for machine-to-machine auth
- urn:ietf:params:oauth:grant-type:device_code: Poll for the tokens of a device authorization (RFC 8628); answered 400 with authorization_pending until the user approves
- refresh_token: Get new access token using refresh token. The refresh token must have been issued to the presenting client_id; one issued to another client is rejected with 400 invalid_grant and is left untouched (not rotated, not revoked).
- urn:ietf:params:oauth:grant-type:token-exchange: Service-account delegation (RFC 8693). A service account exchanges its own token for a five-minute token that acts as one named person from its allow-list. Enterprise edition. The Community build answers this grant with unsupported_grant_type and leaves it out of discovery, so check grant_types_supported rather than assuming it is there. This grant sends no client_id or client_secret — the subject_token is the authentication, since it already carries a verified identity and the scopes that bound it. Refusals about the person asked for all return 400 invalid_target with one wording; the cause is recorded in the delegation log, which only an administrator can read.
For client_credentials, access tokens represent the service account the app is pointed at (tokenIdentityUserId), or the OAuth app creator for an app registered before that was required and never bound. The JWT may encode userId === client_id; the Node API gateway loads the application record on every request and resolves the identity from it, treating the createdBy claim as a cross-check and refusing a token whose claim no longer matches it — see OAuth Provider tag.
Client Authentication: Can be provided via:
- HTTP Basic auth: Authorization: Basic base64(client_id:client_secret)
- Request body: client_id and client_secret parameters
PKCE Verification: If authorization used PKCE, the code_verifier must be provided and will be verified against the stored code challenge.
Request
- Base URLhttps://app.pipeshub.com/api/v1
- URLhttps://app.pipeshub.com/api/v1/oauth2/token
- Authnone required
Request body
Response
Tokens issued successfully
Example response
{
"token_type": "Bearer",
"expires_in": 3600,
"issued_token_type": "urn:ietf:params:oauth:token-type:access_token"
}Changes
- breaking
the
request property's minLength was increased from0to1(media type: application/x-www-form-urlencoded) - breaking
the
request property's minLength was increased from0to1(media type: application/json) - breaking
the
request property's minLength was increased from0to1(media type: application/x-www-form-urlencoded) - breaking
the
request property's minLength was increased from0to1(media type: application/json) - breaking
the
request property's minLength was increased from0to1(media type: application/x-www-form-urlencoded) - breaking
the
request property's minLength was increased from0to1(media type: application/json) - breaking
added to the response body
oneOflist for the response status - breaking
the response's body type changed from
objectto no type for status - breaking
removed the required property
from the response with the status - warning
the
request property's maxLength was set to128(media type: application/x-www-form-urlencoded) - warning
the
request property's maxLength was set to128(media type: application/json) - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - warning
added the new
authorization_pendingenum value to theresponse property for the response status - warning
added the new
expired_tokenenum value to theresponse property for the response status - warning
added the new
slow_downenum value to theresponse property for the response status - info
added the new optional request property
(media type: application/x-www-form-urlencoded) - info
added the new optional request property
(media type: application/json) - info
added the new
urn:ietf:params:oauth:grant-type:device_codeenum value to the request property(media type: application/x-www-form-urlencoded) - info
added the new
urn:ietf:params:oauth:grant-type:device_codeenum value to the request property(media type: application/json) - info
added the non-success response with the status
- breaking
- breaking
the
response's property type changed fromobjecttostringfor status - breaking
removed the required property
/from the response with the status - breaking
removed the required property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
added the new
access_deniedenum value to theresponse property for the response status - warning
added the new
invalid_clientenum value to theresponse property for the response status - warning
added the new
invalid_grantenum value to theresponse property for the response status - warning
added the new
invalid_requestenum value to theresponse property for the response status - warning
added the new
invalid_scopeenum value to theresponse property for the response status - warning
added the new
invalid_targetenum value to theresponse property for the response status - warning
added the new
invalid_targetenum value to theresponse property for the response status - warning
added the new
server_errorenum value to theresponse property for the response status - warning
added the new
unauthorized_clientenum value to theresponse property for the response status - warning
added the new
unsupported_grant_typeenum value to theresponse property for the response status - info
added the new optional request property
(media type: application/x-www-form-urlencoded) - info
added the new optional request property
(media type: application/json) - info
added the new optional request property
(media type: application/x-www-form-urlencoded) - info
added the new optional request property
(media type: application/json) - info
added the new optional request property
(media type: application/x-www-form-urlencoded) - info
added the new optional request property
(media type: application/json) - info
added the new
urn:ietf:params:oauth:grant-type:token-exchangeenum value to the request property(media type: application/x-www-form-urlencoded) - info
added the new
urn:ietf:params:oauth:grant-type:token-exchangeenum value to the request property(media type: application/json) - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status
- breaking