This is an internal endpoint used by authentication flows. It completes the Supabase OAuth or magic link flow and redirects the user. Clients do not call this endpoint directly.
- Endpoint:
GET /auth/callback - File Location:
src/app/auth/callback/route.ts
Query parameters
OAuth authorization code from the provider. When present, the server exchanges it for a session.
Supabase email/magic link token hash used with
type to verify email OTP flows.Auth flow type. Common values:
signup, email, recovery.Relative path to redirect after successful auth. Non-relative values are ignored to prevent open redirects. Defaults to
/dashboard.Behavior
-
When
codeexists (OAuth):- Exchanges code for a session.
- If
type=recovery: redirects to/reset-password. - If
type=signup: redirects to/dashboard. - Otherwise: redirects to
next(if relative) or/dashboard.
-
When
token_hashandtypeexist (email/magic link):- Verifies OTP with the given type.
- If
type=recovery: redirects to/reset-password. - If
type=signuportype=email: redirects to/dashboard. - Otherwise: redirects to
next(if relative) or/dashboard.
-
On failure: redirects to
/sign-in?error=auth_failed.
Examples
Example Request (OAuth code)
Example Response
Example Request (Magic link)
Example Response
See Authentication for full flow diagrams, UI routes, and server action usage.