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