/api/oidc/tokenPublicToken endpoint
The OAuth 2.0 / OIDC token endpoint (RFC 6749 §3.2, form-encoded). Four grants: authorization_code (PKCE code_verifier required, redirect_uri must match; mints an id_token when the grant's scope includes openid), refresh_token (rotates the refresh token; the previous one is revoked), client_credentials (confidential clients only; mints a machine-to-machine access token for the app's service account, no refresh token), and RFC 8693 token exchange (urn:ietf:params:oauth:grant-type:token-exchange; confidential clients only: swaps a user's access token for an API server for a delegated access token on which the app's service account acts for that user (act claim), for the same API server, with at most the same scope; the API server must accept delegated tokens, else invalid_target; no refresh token). @schemavaults/auth-server extensions: the RFC 8707 resource parameter mints the access token for a registered API server, and refresh_token_delivery=http_only_cookie delivers the refresh token as an HTTP-only cookie (Set-Cookie) instead of in the body; every response with a refresh token carries refresh_token_expires_in. Browser callers (with an Origin header) must come from one of the client app's registered origins and then receive a credentialed CORS allowance; other callers get Access-Control-Allow-Origin: *. refresh_token, client_credentials and token exchange requests are rate limited per IP. Responses carry Cache-Control: no-store.
post_api_oidc_tokenOpenID Connect / OAuth 2.0Authentication & permissionsPublic
Anyone — no credentials required
- Accepted credentials
- None required
- Notes
- Client authentication per RFC 6749 §2.3: public clients send
client_idonly (PKCE is the security boundary); confidential clients (apps with a registered client secret) must authenticate withclient_secret_basic(HTTP BasicAuthorizationheader) orclient_secret_post(client_secretform field). The handler performs this itself.
Request body
Required — Form-encoded token request. Which fields are required depends on grant_type.
| Property | Type | Description |
|---|---|---|
| grant_type* | "authorization_code" | "refresh_token" | "client_credentials" | "urn:ietf:params:oauth:grant-type:token-exchange" | Which grant to redeem. |
| client_id | string | The client application id. May be omitted when the client authenticates with minLength: 2maxLength: 64pattern: ^[a-z0-9_-]*$ |
| client_secret | string |
|
| code | string |
|
| redirect_uri | string |
|
| code_verifier | string |
|
| refresh_token | string |
|
| scope | string |
|
| subject_token | string | Token exchange (RFC 8693): the access token a user holds for an API server, issued to this client. The delegated token is minted for the same user, client and API server. Token exchange only, like every RFC 8693 parameter ( |
| subject_token_type | "urn:ietf:params:oauth:token-type:access_token" | Token exchange only: REQUIRED; only access tokens are exchanged. |
| requested_token_type | "urn:ietf:params:oauth:token-type:access_token" | Token exchange only: optional; only access tokens are issued. |
| resource | string | RFC 8707 resource indicator, as extended by @schemavaults/auth-server: the URL of a registered API server; the |
| refresh_token_delivery | "inline" | "http_only_cookie" | @schemavaults/auth-server extension: |
Responses
| Header | Type | Description |
|---|---|---|
| Cache-Control | string | |
| Set-Cookie | string | Refresh token cookies when refresh_token_delivery=http_only_cookie was requested. |
| Property | Type | Description |
|---|---|---|
| access_token* | string | Encrypted (JWE) access token; opaque to the client. |
| token_type* | "Bearer" | |
| expires_in* | integer | Access token lifetime in seconds. |
| refresh_token | string | Omitted for |
| refresh_token_expires_in | integer | @schemavaults/auth-server extension: seconds until the (possibly cookie-delivered) refresh token expires. |
| scope | string | Scope of the issued access token: the granted OIDC scopes, plus the grant's API scopes when the access token is minted for the API server that defines them. Omitted when it holds nothing (plain OAuth 2.1 grant). |
| id_token | string | RS256-signed id_token; only on an |
| issued_token_type | "urn:ietf:params:oauth:token-type:access_token" | Token exchange only (RFC 8693 §2.2.1): the type of the issued token. |
Example request
curl -X POST 'https://auth.schemavaults.com/api/oidc/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'client_id=my-web-app' \
--data-urlencode 'client_secret=string' \
--data-urlencode 'code=string' \
--data-urlencode 'redirect_uri=string' \
--data-urlencode 'code_verifier=string' \
--data-urlencode 'refresh_token=string' \
--data-urlencode 'scope=string' \
--data-urlencode 'subject_token=string' \
--data-urlencode 'subject_token_type=urn:ietf:params:oauth:token-type:access_token' \
--data-urlencode 'requested_token_type=urn:ietf:params:oauth:token-type:access_token' \
--data-urlencode 'resource=https://api.example.com' \
--data-urlencode 'refresh_token_delivery=inline'