Преглед изворни кода

fix: use service role client for oauth_states insert #17

Claude пре 5 месеци
родитељ
комит
585b6f76a3
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      supabase/functions/oauth-woocommerce/index.ts

+ 4 - 1
supabase/functions/oauth-woocommerce/index.ts

@@ -176,8 +176,11 @@ serve(async (req) => {
       // Generate state for CSRF protection
       const state = crypto.randomUUID()
 
+      // Create Supabase admin client for storing state (requires service role)
+      const supabaseAdmin = createClient(supabaseUrl, supabaseServiceKey)
+
       // Store state in database
-      const { error: stateError } = await supabase
+      const { error: stateError } = await supabaseAdmin
         .from('oauth_states')
         .insert({
           state,