Auth API reference

Auth API · Consumer-Oauth-Sign-In

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

Sign in / sign up with a provider ID token (native flow)

Submit the provider-issued ID token from a native client (iOS ASAuthorizationController, Google Sign-In for iOS / Android). Backend verifies the token signature, issuer, audience (against this app's configured native client ids), and nonce binding; consumes the nonce server-side to defeat in-window replay; resolves or creates the Auth account; mints access + refresh tokens with `amr=["oauth", "<provider>"]`. Same response shape as `/auth/signin`.

Path parameters

app_slug*string

Slug of the app.

provider*enum (3)

OAuth provider id. Native flow supports: apple, google. GitHub is web-only — POSTing to this endpoint with provider=github 400s.

Request body

id_token*string

Provider-issued ID token (JWT). For Apple, the value returned by `ASAuthorizationAppleIDCredential.identityToken` after UTF-8 decoding the data.

Example: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJzdWIiOiJ1c3JfMSJ9.c2lnbmF0dXJl"

nonce*string

Raw nonce the client generated and SHA-256-hashed into the authorize request. Backend recomputes the hash and compares to the token's `nonce` claim. Must be at least 32 bytes of entropy (base64url-encoded ~43 chars).

Example: "n-0S6_WzA2Mj"

userobject

Apple-specific first-signin payload: { name, email }. Persist for display only — the verified JWT is the source of truth.

Response · 200 Either a token pair or, when the app runs `auth_config.mfa: "required"` and the account holds no enabled factor, an enrolment demand (`mfa_enrollment_required: true`) with no session behind it. Branch on `mfa_enrollment_required`.

object

Example

Request

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

{
  "id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJzdWIiOiJ1c3JfMSJ9.c2lnbmF0dXJl",
  "nonce": "n-0S6_WzA2Mj",
  "user": {}
}

Response

{}