Exchange Supabase tokens for session cookies
POST
/auth/exchange-supabase-token
const url = 'https://example.com/api/auth/exchange-supabase-token';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"access_token":"example","refresh_token":"example","redirect_to":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/auth/exchange-supabase-token \ --header 'Content-Type: application/json' \ --data '{ "access_token": "example", "refresh_token": "example", "redirect_to": "example" }'Accepts Supabase access/refresh tokens, sets session cookies, returns redirect URL.
Request Body required
Section titled “Request Body required ” Media type application/json
object
access_token
required
string
refresh_token
required
string
redirect_to
string
Responses
Section titled “ Responses ”Session established
Media type application/json
object
redirectTo
string
Invalid request
Media type application/json
object
error
required
Human-readable error message
string
code
Stable machine-readable error code for client branching
string
fieldErrors
First validation message per field path
object
key
additional properties
string
issues
Structured validation issues (Zod)
Array<object>
object
path
required
string
message
required
string
retryAfter
Seconds until rate limit resets (429 responses)
number