/api/oidc/tokenPublicToken endpoint
The OAuth 2.0 / OIDC token endpoint (RFC 6749 §3.2, form-encoded). Three 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), and client_credentials (confidential clients only; mints a machine-to-machine access token for the app's service account, 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 and client_credentials 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" | 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 |
|
| 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 | Granted scope; omitted when nothing was granted (plain OAuth 2.1 grant). |
| id_token | string | RS256-signed id_token; only on an |
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 'resource=https://api.example.com' \
--data-urlencode 'refresh_token_delivery=inline'