Headless SMS signup
Overview
Leveraging Dynamic’s React package, this guide will help you create a sign in / sign up flow based on an sms login form.
We use the useConnectWithOtp
hook to expose two methods: connectWithSms
and verifyOneTimePassword
.
The first method will send an SMS to the user’s phone number, and the second will verify the OTP sent to the user’s phone.
Once that’s done, the user will be authenticated and you can access their information through the useDynamicContext
hook!
Dashboard Setup
SMS Signup/Login
The first thing you’ll want to do is create a new Dynamic organization and setup Dashboard.
- Sign up at app.dynamic.xyz
- Fill in the modal to create your organization and project.
- Under the Developer menu, go to SDK & APIs and fetch the Environment ID. Keep this as we’ll need this key in a little bit.
Next we’ll want to enable SMS signup/login:
For more information on how to configure SMS signup/login, check out our SMS Signup/Login guide.
Configuring the SDK
Let’s start by installing our packages. Follow our Quickstart guide for a detailed walkthrough.
When you’re done, we’ll update our App.js to include our environment ID in the setup and import the DynamicContextProvider
and EthereumWalletConnectors
.
You app.js file should look like this (note that we are only importing the EthereumWalletConnectors for now):
SMS Signup/Login UI
Now that we have our environment, we can create our SMS signup/login form. We use the useConnectWithOtp
hook to handle the SMS setup.
Was this page helpful?