Best practice for supporting both DB and Passwordless connections in React

Hello! I’m integrating auth0-react in our application and everything is working great with the DB connection. I’m trying to also support Passwordless logins/signups with SMS and am running into some trouble.

I’m wrapping the App in a Auth0Provider as the quickstart suggested. I have everything configured properly within the Auth0 console for Passwordless SMS authentication. However, I’m not able to see the option to authenticate with a phone number unless I specify connection: "sms" in the Auth0Provider declaration within main.tsx. If I do configure the provider with this option then I’m able to auth with SMS but then I’m no longer to auth with email. I have two separate buttons on our landing page page (e.g. “Continue with Email” and “Continue with Phone Number”), but I can’t figure out how to pass the connection option into the react-auth0 login method or modify the provider based on which button is selected :confused: .

My question is: What is the recommended implementation for supporting the option to auth with passwordless SMS or email? Thank you for your help.

I was able to solve this myself. For anyone else who comes across this, I was able to pass authorizationParams, that specified the connection, to the loginWithRedirect(...) function. It looks like this:

loginWithRedirect({authorizationParams: { connection: "sms" }})
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.