SupabaseS
Supabase2mo ago
Baran

I can't enroll 2fa with messagebird / bird

Aim:
Allow my app's users to enroll a MFA via phone/SMS.

Issue:
When the UI calls enroll, then the Supabase server responds with 200 HTTP status code, but that phone number never receives the OTP.


Setup:
I am an admin of a MessageBird / Bird org. I added my Messagebird Access Key and Messagebird Originator (see attached screenshots), which were manually tested in the Messagebird dashboard to send a text message.

My debug attempt:
  • Messagebird logs are empty.
  • I added an incorrect Messagebird Access Key, and the server is still responding with 200 HTTP status code. But I expected it to throw an error.
So, perhaps an unknown issue has occurred on the Supabase instance?

Code:
  • latest supabase-js version```tsxexport const useEnrollMfa = <Channel extends Setup2faChannel>({channel,}: {channel: Channel;}) => {return useMutation({ mutationKey: ["mfaEnroll", channel], mutationFn: async ({ phoneNumber }: { phoneNumber: string }) => { const factors = await supabase.auth.mfa.listFactors(); if (factors.error) { captureException("Failed to list MFA factors.", { level: "error", extra: { factorsError: factors.error }, }); throw factors.error; } const { data } = await supabase.auth.mfa.enroll({ factorType: "phone", phone: phoneNumber, // in E.164 format friendlyName: "smsA", }); return data; },});};```
Request:
Endpoint: /auth/v1/factors
Body:
{
    "friendly_name": "smsA",
    "factor_type": "phone",
    "phone": {SECRET} // in E.164 format
}


Response:
Status Code: 200 OK
Body:
{
    "id": "9905ab4d-{SECRET}",
    "type": "phone",
    "friendly_name": "smsA",
    "phone": {SECRET}
}
image.png
image.png
Was this page helpful?