Integrating With Supabase Auth
Edge Functions work seamlessly with Supabase Auth, allowing you to identify which user called your function.
When invoking a function with one of the client libraries, the logged in user's JWT is automatically attached to the function call and becomes accessible within your function.
This is important, for example, to identify which customer's credit card should be charged. You can see this concept end-to-end in our Stripe example app.
Auth Context & RLS#
By creating a supabase client with the auth context from the function, you can do two things:
- Get the user object.
- Run queries in the context of the user with Row Level Security (RLS) policies enforced.
See the example on GitHub.