SMS Passwordless Login with Web3Auth
Create a SMS Passwordless verifier
-
Go to the Web3Auth dashboard and select your project. Click on the
Custom Authentication
tab, then click on theCreate Verifier
button to create a new verifier.
-
Give a unique name to your verifier in the
Verifier Identifier
field. e.g.,sms-passwordless-verifier
. -
From the list of Login Providers, select
Social Login Providers
and Select SMS Passwordless from the dropdown list.
- Finally, click on the
Create
button to create the SMS Passwordless verifier.
It typically takes 5-10 minutes for the verifier to go live. Once deployed & live, you'll receive an email and the dashboard will display the 'Live' status for the verifier.
Example
- Modal SDK
- No Modal SDK
import { AuthAdapter } from "@web3auth/auth-adapter";
// Create AuthAdapter instance once you have created Web3Auth instance
const authAdapter = new AuthAdapter({
adapterSettings: {
loginConfig: {
// SMS Passwordless login
sms_passwordless: {
verifier: "w3a-sms-passwordless-demo", // Pass your verifier name here
typeOfLogin: "sms_passwordless",
},
},
},
});
// Configure the adapter with Web3Auth
web3authInstance.configureAdapter(authAdapter);
// Initialize Modal
await web3authInstance.initModal();
// Login with SMS Passwordless
await web3authInstance.connect();
import { AuthAdapter } from "@web3auth/auth-adapter";
// Create AuthAdapter instance once you have created Web3AuthNoModal instance const authAdapter =
new AuthAdapter({ adapterSettings: { uxMode: "redirect", loginConfig: { // focus-start
sms_passwordless: { verifier: "w3a-sms-passwordless-demo", // Pass your verifier name here
typeOfLogin: "sms_passwordless" } // focus-end } } });
// Configure the adapter with Web3AuthNoModal web3authNoModalInstance.configureAdapter(authAdapter);
// Initialize await web3authNoModalInstance.init();
// Login with SMS Passwordless // focus-start await
web3authNoModalInstance.connectTo(WALLET_ADAPTERS.AUTH, { loginProvider: "sms_passwordless",
extraLoginOptions: { login_hint: phone.trim() } }); // focus-end