SupabaseS
Supabase2mo ago
Baran

How to call `.enroll` when "Verify Enabled"?

Overall aim
Prevent users from adding/removing totp mfa/2fa without confirming another 2fa method (e.g., their email address, or phone number) to increase the app's security. This is a common practice across many apps.

What Supabase supports
When "Enabled", the UI can:
  • ✅ .enroll
  • ✅ .challenge
  • ✅ .verify
When "Verify Enabled", the UI can:
  • ❌ .enroll
  • ✅ .challenge
  • ✅ .verify
So far, I tried:
  • supabaseAdminClient.auth.mfa.enroll: .enroll throws the same error acting like it's a non-admin link
  • supabaseAdminClient.auth.admin.mfa.enroll: doesn't exist
Issue/question
How can I have the "Verify Enabled" behaviour, and call .enroll (e.g., with an admin client) so I can create a custom enrollment flow in the server (e.g., edge function)?

Environment:
  • "@supabase/supabase-js": "^2.80.0", (latest as of now)
image.png
Was this page helpful?