Documentation
GET /api/auth/callback
Redeem a magic link.
| Request | GET /api/auth/callback |
|---|---|
| Authentication | Called by an external provider |
| Handler | flowfinds-organ/app/api/auth/callback/route.ts |
What it does
Consumes the token and redirects. Every outcome is a 302: to the validated `returnTo` on success — which may still carry `?jc=<carrierId>` from before the redirect to sign-in — and to `/login?error=…` otherwise, with distinct messages for an expired link and an invalid one. `POST` answers 405 with `Allow: GET, HEAD`.
Authentication
Called by an external provider. Invoked by a payment or billing provider, or by the browser it redirects.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
token | query | string | Required | The token from the emailed link. |
Request
The cookie jar carries the session between calls. Angle-bracketed values are the parameter types from the table above.
curl -s -b cookies.txt -c cookies.txt \
"https://flowfinds.ai/api/auth/callback?token=<string>"const res = await fetch("https://flowfinds.ai/api/auth/callback?token=<string>", {
method: "GET",
credentials: "include",
});
const data = await res.json();import requests
s = requests.Session()
r = s.get("https://flowfinds.ai/api/auth/callback?token=<string>")
data = r.json()Recorded example
curl -s -i "$FLOWFINDS_ORIGIN/api/auth/callback?token=…"Responses
302 — Always: to `returnTo` on success, to `/login?error=…` on an expired or invalid token.
Errors
| Status | Reason | When |
|---|---|---|
405 | — | The method is POST. |
Related
POST /api/intent— Ask the commerce assistant, or resolve a navigation intent.POST /api/pages— Generate a page from an intent.POST /api/journey— Issue a single-use journey carrier.POST /api/journey/[id]/consume— Redeem a journey carrier once.GET /api/walkthrough— The walkthrough's steps and this user's position in it.POST /api/walkthrough/advance— Move forward or back a step.POST /api/walkthrough/dismiss— Dismiss the walkthrough.POST /api/auth/request-link— Request a magic sign-in link.
Back to the API reference index, or read the cookbook for recipes that compose this endpoint with others.