is this secure
I’m creating two server-side Supabase clients in Next.js:
- One “clean” client that isn’t affected by cookies to use the service role key.
- One client that uses cookies for normal user sessions.
Both clients run only server-side. Is this the correct approach to safely leverage the service role key while handling user sessions?
1 Reply
No this isn't correct. As long as you are using the
createServerClient from the @supabase/ssr client they will share session. You should be using a createClient from @supabase/supabase-js for the admin client. https://github.com/orgs/supabase/discussions/15860GitHub
Performing administration tasks on the server side with the service...
This is a copy of a troubleshooting article on Supabase's docs site. It may be missing some details from the original. View the original article. By default, the auth-helpers/ssr do not permit ...