Auth
An Edge Function turns auth off and never checks the caller
Cataloged October 16, 2026 · Lovable · Bolt · Cursor · Supabase
Symptom
A function that changes data or spends money returns 200 with no session. It was set to verify_jwt = false, or auth: 'none', to clear a 401 during development.
Root cause
Supabase's Edge Function auth guide says the default is verify_jwt = true, so the platform checks the user JWT before the handler runs. Turning that off to get past a 401 removes the platform check. auth: 'none' accepts every caller. The guide says that mode is for a public health check, or for a webhook that verifies the provider's own signature inside the handler. If the function reads or writes sensitive data, the handler has to authenticate the caller itself. Lovable's best practices say a function running on the server is still callable by a client, so server-side execution alone is not privacy.
Before and after
Supabase documents verify_jwt = true as the default. auth: 'none' stays only for a health check or a webhook that verifies a signature.
Before
verify_jwt = false
After
verify_jwt = true
Fix prompt
In this project only, open supabase/config.toml and every Edge Function. 1. For functions called by a signed-in user, keep verify_jwt = true and use auth: 'user'. Read data with the RLS-scoped client. 2. For a webhook, keep verify_jwt = false and auth: 'none', and verify the provider signature before any write. Reject missing signatures with 400. 3. Delete auth: 'none' from any function that updates users, deletes rows, or calls a paid API, unless it verifies a signature. 4. Do not deploy a function that mutates data with no caller check. Only edit this project's functions.
Paste this into the coding tool that has your own project open.
2-minute self-check
These steps are for an app you own. Do not run them against someone else's project.
- In your own repo, search for verify_jwt = false and auth: 'none'.
- For each match, read the handler. It should verify a webhook signature or do nothing sensitive.
- While signed out of your own app, trigger the function the way your UI does, without a session. A mutating function should reject you.
Common questions
The function returns 200 with no session. What setting caused that?
It was set to verify_jwt = false, or auth: 'none', to clear a 401 during development. Supabase's default is verify_jwt = true, so the platform checks the user JWT before the handler runs. Turning that off removes the platform check. auth: 'none' accepts every caller. Search your own repo for those settings.
When is auth: 'none' the documented choice?
A public health check, or a webhook that verifies the provider's own signature inside the handler and rejects a missing signature with 400. A function that updates users, deletes rows, or calls a paid API needs a caller check. Server-side execution alone is not privacy: a client can still call the function.
Longer guide
- OpenAI API key exposed in the frontend: check your own app
Which keys are meant to be public, why a NEXT_PUBLIC_ or VITE_ prefix ships the others, and what to do on your own app if a secret key is in the bundle or the git history.