Thread
#general
    Leonxx

    Leonxx

    4 days ago
    Hey. I'm trying to implement Passwordlaess method with email and magic link with custom vue UI
    r

    rp

    4 days ago
    hey @Leonxx
    @nkshah2 can help here
    Leonxx

    Leonxx

    4 days ago
    ok tnx
    n

    nkshah2

    4 days ago
    Hi, So for magic links you want to do the following: 1. Initialise the Passwordless recipe
    import 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 internally
    Leonxx

    Leonxx

    4 days ago
    consumeCode without any parameters?
    n

    nkshah2

    4 days ago
    Yep
    It reads from the current location which will be the magic link url
    Leonxx

    Leonxx

    4 days ago
    ok let me try