OptionalauthAuth mode(s) to accept. Modes are tried in order — the first match wins.
A mode falls through only when its credential is absent; a present-but-invalid
JWT short-circuits the chain with InvalidJwtError (INVALID_JWT).
"none" matches unconditionally, so it belongs last in a list or on its
own — see AuthConfig.
OptionalallowUse WithSupabaseConfig.auth instead. The allow option
is kept for backward compatibility and will be removed in a future major release.
When both auth and allow are provided, auth takes precedence. It keeps
the older, looser element type so code mid-migration still compiles; auth
is where the AuthConfig ordering rule is enforced.
OptionalaudienceAccepted aud claim value(s) for user mode. When set, a token without
aud is rejected, and a token whose aud is an array passes when any
entry is accepted.
OptionalissuerAccepted iss claim value(s) for user mode. When set, a token without
iss is rejected. Supabase Auth issues https://<project-ref>.supabase.co/auth/v1,
which fromSupabaseUrl(url) builds from a project URL.
OptionalenvOverride auto-detected environment variables. Useful for testing or when running in environments without standard env var support.
OptionalcorsCORS configuration for the withSupabase wrapper.
'default' — uses @supabase/supabase-js default CORS headers.'disabled' — disables CORS handling entirely.{ headers } — custom CORS headers.The boolean (true/false) and bare Record<string, string> forms are
deprecated but still accepted for backward compatibility.
Only applies to the top-level withSupabase wrapper. The adapters (Hono, H3, Elysia, NestJS) handle CORS separately via each framework's own middleware.
OptionalsupabaseOptions forwarded to both internal createClient() calls.
accessToken is stripped, and auth settings (persistSession, autoRefreshToken,
detectSessionInUrl) are force-overwritten to server-safe values.
OptionalerrorsHow much of an error to include in the response body.
Applies to the responses withSupabase produces. The error object itself is always fully populated, so createSupabaseContext and the framework adapters still see everything.
Configuration for withSupabase and createSupabaseContext.
Controls which auth modes are accepted, environment overrides, and CORS behavior.
Example: Basic usage