palbaseDocs

Palbase Auth API · API

POST/auth/magic-link

Request passwordless magic link

Always returns 200 (enumeration prevention). When the email belongs to an account the server emails a single-use signed link / OTP. Subject to per-IP rate limiting. Asks a proof of work first (403 pow_required, which the SDKs solve), its difficulty rising when the project's attempts surge: a bot that posts it in a loop pays seconds a request.

Called by your app, with the publishable key.

Headers

X-PoW-Challenge-IDstring · optionalThe challenge a previous `pow_required` answer carried.
X-PoW-Noncestring · optionalThe nonce that solves it.

Request body

auth_request_idstring · optionalThe pending /oauth/authorize request the sign-in is for: one that is not waiting is refused with 400 `auth_request_invalid` before an email is sent. The email's link then opens at the provider (`GET /oauth/authorize/email`), and a six-digit code goes beside it: in the browser that opened the request the link leads to the sign-in page with `auth_request_id` and `email_token`; on another device it tells the person to type the code in the tab they started in (`POST /auth/magic-link/verify` with `auth_request_id` and `code`). `redirect_to` does not apply.
emailstring (email) · required
redirect_tostring (uri) · optionalWhere the sign-in link lands instead of the project's site URL: an address the auth settings' redirect_urls allow, or one of the project's web apps' redirects (apps:env:set --redirect); any other is refused (invalid_redirect).
curl
curl -X POST "https://<your-ref>.palbase.studio/auth/magic-link" \
  -H "apikey: $PALBASE_PUBLISHABLE_KEY" \
  -H "content-type: application/json" \
  -d '{"email":"user@example.com"}'

Responses

200Magic link queued (or pretend-success)

403A proof of work is required (`pow_required`, with the challenge): this route sends an email, and its work rises with the project's surge of attempts — 16 bits, 20 past 30 attempts a minute, 24 past 120. The SDKs solve it and send the request again.

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation MagicLinkRequest of auth's contract.