/{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*stringSlug of the app.
provider*stringOAuth provider id. Native flow supports: `apple`, `google`, `microsoft` (with `native_client_ids` configured). GitHub and OpenID Connect providers (`oidc-<key>`) are web-only: this endpoint answers 400 for them.
Request body
id_token*stringProvider-issued ID token (JWT). For Apple, the value returned by `ASAuthorizationAppleIDCredential.identityToken` after UTF-8 decoding the data.
Example: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJzdWIiOiJ1c3JfMSJ9.c2lnbmF0dXJl"
nonce*stringRaw 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"
userobjectApple-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": {}
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const signin = await auth.consumer("my-app").signinWithProvider("google", {
id_token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJzdWIiOiJ1c3JfMSJ9.c2lnbmF0dXJl",
nonce: "n-0S6_WzA2Mj",
});auth.consumer(…).signinWithProvider(provider, params, options?): Auth.SigninWithProviderResponse
Response
{}