Leonxx
09/22/2022, 9:39 AMrp_st
09/22/2022, 9:41 AMrp_st
09/22/2022, 9:41 AMLeonxx
09/22/2022, 9:42 AMnkshah2
09/22/2022, 9:51 AMimport Session from "supertokens-web-js/recipe/session"
import Passwordless from "supertokens-web-js/recipe/passwordless"
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
},
recipeList: [
Session.init(),
Passwordless.init()
],
});
2. Send the user an email with the magic link/code
Passwordless.createCode({email: ""}) // or use {phoneNumber: ""}
This will send an email to the user (If you configure the recipe to use magic links on the backend, the email will use magic links)
3. When the user visits your frontend (using the magic link in the email), you can use consumeCode
to log the user in
Passwordless.consumeCode()
The createCode function reads the information from the magic link internallyLeonxx
09/22/2022, 9:52 AMnkshah2
09/22/2022, 9:53 AMnkshah2
09/22/2022, 9:53 AMLeonxx
09/22/2022, 9:53 AMLeonxx
09/22/2022, 9:57 AMnkshah2
09/22/2022, 10:00 AMLeonxx
09/22/2022, 10:12 AMnkshah2
09/22/2022, 10:13 AMLeonxx
09/22/2022, 10:14 AMnkshah2
09/22/2022, 10:14 AMPasswordless.consumeCode()
Leonxx
09/22/2022, 10:26 AMnkshah2
09/22/2022, 10:27 AMLeonxx
09/22/2022, 10:28 AMLeonxx
09/22/2022, 10:33 AM