/v1/apps/{app_id}/sign-in-testsAuthStart a sign-in test: prove sign-in works without creating a user.
For `oauth`, the server first checks what it can on its own (an allowed redirect origin, saved credentials, and the provider credential check). If one fails, the test comes back `failed` at once with the fix. Otherwise open `start_url` in a popup: the person signs in at the provider, the provider returns to Auth, Auth resolves who it is exactly as a real sign-in would, records `would_sign_in_existing` or `would_create` (or the provider error mapped to its fix), creates no account and issues no token, then sends the popup to the console result page. Poll `GET …/sign-in-tests/{id}` until `state` is not `pending`. Works with a provider that is saved but not switched on yet. For `password` / `otp`, the test runs now: it checks the sign-up or sign-in rules for your own email and sends the real email to your own verified address. At most 20 tests per app per hour; tests are deleted after 24 hours.
Path parameters
app_id*stringId of the app.
Headers
Idempotency-KeystringStripe-style idempotency key. A retried create with the same key returns the same test instead of sending a second email or starting a second test. 24h TTL.
Request body
method*enum (3)`oauth`: sign in at a provider in a popup (needs `provider`). `password`: checks the sign-up / sign-in rules for your own email and sends the real verification email to you when emails are set up (the test passes without it, like real sign-up). `otp`: the same with the sign-in code email, which it needs. Emails only ever go to your own verified address.
Example: "oauth"
providerstringProvider to test (`oauth` tests only). The sign-in provider: `apple`, `google`, `github`, `microsoft`, or `oidc-<key>` for an OpenID Connect provider you added (the key is 1 to 32 lowercase letters, digits or hyphens that you choose, for example `oidc-okta`).
Example: "google"
custom_domainboolean`oauth` only: run the test on the app's active custom domain instead of `api.auth.productcraft.co`, so the provider sees the custom host and its callback URL. The provider's app must list that callback URL too.
Example: false
Response · 201 The test, already settled for `password` / `otp` and for an `oauth` test that failed its checks.
id*string · uuidUnique identifier of the sign-in test.
Example: "6f1c2b8e-3a4d-4e5f-8a9b-0c1d2e3f4a5b"
app_id*string · uuidThe Auth app the sign-in test belongs to.
Example: "0b6f3c7e-6a43-4c55-9d4b-2a9a7f5b1c11"
method*object`oauth` (sign in at a provider in a popup) or `password` (checks the sign-up and sign-in rules and sends the test emails).
Example: "oauth"
provider*stringThe provider tested (`oauth` tests), or `null`. The sign-in provider: `apple`, `google`, `github`, `microsoft`, or `oidc-<key>` for an OpenID Connect provider you added (the key is 1 to 32 lowercase letters, digits or hyphens that you choose, for example `oidc-okta`).
Example: "google"
state*object`pending`: waiting for the sign-in at the provider (open `start_url`). `succeeded`: the sign-in would work; see `outcome` and `identity`. `failed`: see `error` for the fix. A test that is never finished becomes `failed` with code `expired`.
Example: "pending"
outcome*objectWhat a real sign-in would have done: sign in an existing user, or create a new one. The test itself never creates or links an account.
Example: "would_create"
identity*objectWho signed in during the test, once it completes; `null` before that.
error*objectWhy the test failed, or `null`.
email_delivery*objectSucceeded `password` / `otp` tests: whether the email went out. A `password` test passes even when it did not, because real sign-up and sign-in do not need it; `notice` says why and how to turn it on. Null for `oauth` tests and failed tests.
start_url*string · uriOAuth tests only: open this in a popup to sign in at the provider. Works once, until `expires_at`. Null once used, for password and email-code tests, and when the test already failed its checks.
Example: "https://api.auth.productcraft.co/acme/v1/auth/oauth/google/authorize?return_to=https%3A%2F%2Fconsole.productcraft.co%2Fauth%2Fsign-in-test%2Fcallback&sign_in_test=6f1c2b8e-3a4d-4e5f-8a9b-0c1d2e3f4a5b"
callback_host*string · hostnameThe custom domain the test runs on (`custom_domain: true`), or null for the canonical host. The start link is on this host and the provider is sent its callback URL, `https://<callback_host>/v1/auth/oauth/<provider>/callback`.
Example: "auth.acme.com"
expires_at*string · date-timeThe start link works until then (10 minutes).
created_at*string · date-timeWhen the sign-in test was created (ISO 8601).
completed_at*string · date-timeWhen the test completed (ISO 8601), or `null` while it runs.
Example
Request
POST https://api.auth.productcraft.co/v1/apps/{app_id}/sign-in-tests
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"method": "oauth",
"provider": "google",
"custom_domain": false
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const signInTest = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").signInTests.create({ method: "oauth" });auth.admin.app(…).signInTests.create(params, options?): Auth.SignInTest
Response
{
"id": "6f1c2b8e-3a4d-4e5f-8a9b-0c1d2e3f4a5b",
"app_id": "0b6f3c7e-6a43-4c55-9d4b-2a9a7f5b1c11",
"method": "oauth",
"provider": "google",
"state": "pending",
"outcome": "would_create",
"identity": {},
"error": {},
"email_delivery": {},
"start_url": "https://api.auth.productcraft.co/acme/v1/auth/oauth/google/authorize?return_to=https%3A%2F%2Fconsole.productcraft.co%2Fauth%2Fsign-in-test%2Fcallback&sign_in_test=6f1c2b8e-3a4d-4e5f-8a9b-0c1d2e3f4a5b",
"callback_host": "auth.acme.com",
"expires_at": "2026-01-01T00:00:00.000Z",
"created_at": "2026-01-01T00:00:00.000Z",
"completed_at": "2026-01-01T00:00:00.000Z"
}