Creates an admin Supabase client that bypasses Row-Level Security.
Uses a secret key for authentication, giving full access to all data.
Stateless — one client per request.
Which key is used
With auth.keyName set, that named key from SUPABASE_SECRET_KEYS is used —
and it throws if the key doesn't exist. With keyName omitted, the default
key is used, falling back to the first key in the set when no default exists.
Note this differs from the "secret" auth mode, which matches the default
key only and never falls back — see index.AuthModeWithKey.
index.EnvError If SUPABASE_URL is missing or the specified secret key is not found.
Example: Basic usage
// Uses the `default` secret key (or the first key if no `default` exists) constsupabaseAdmin = createAdminClient() const { data } = awaitsupabaseAdmin.from('audit_log').insert({ action:'user_login' })
Creates an admin Supabase client that bypasses Row-Level Security.
Uses a secret key for authentication, giving full access to all data. Stateless — one client per request.
Which key is used
With
auth.keyNameset, that named key fromSUPABASE_SECRET_KEYSis used — and it throws if the key doesn't exist. WithkeyNameomitted, thedefaultkey is used, falling back to the first key in the set when nodefaultexists.Note this differs from the
"secret"auth mode, which matches thedefaultkey only and never falls back — see index.AuthModeWithKey.