Platform API reference

Platform API · OAuth Sign-In

post/v1/auth/oauth/{provider}/callback

Complete a federated sign-in. auth-ui proxies the provider redirect (query params for Google/GitHub, form_post body for Apple) into this endpoint and uses the returned `tokens` to set the auth_token cookie.

Path parameters

provider*enum (3)

The sign-in provider: `google`, `github` or `apple`.

Request body

state*string

Opaque state token returned by the IdP, minted at `/start`. Single-use; binds the callback to a specific browser session.

id_tokenstring

JWT id_token from the IdP (OIDC providers; Apple form_post). Optional — either `idToken` or `code` must be supplied.

codestring

OAuth authorization code returned by the IdP. Optional — either `idToken` or `code` must be supplied.

userstring

Apple-only first-signin payload: JSON-encoded `{ name, email }`. Apple returns this only the first time a user signs in. Not signed — treated as untrusted input by the controller's payload parser.

Response · 200

tokens*object

Issued PlatformUser session tokens. auth-ui sets the auth_token cookie from `accessToken` and 302s the browser to `return_to`.

return_to*string

Original `return_to` the user was sent off with. auth-ui redirects here after writing the cookie.

Example

Request

POST https://api.platform-auth.productcraft.co/v1/auth/oauth/{provider}/callback
Content-Type: application/json

{
  "state": "string",
  "id_token": "string",
  "code": "string",
  "user": "string"
}

Response

{
  "tokens": {},
  "return_to": "string"
}