Magic Link Passwordless - magic link could not be created

Options

I implemented Magic Link passwordless, following the video by Prakash and set-up all the variables in the Settings page.

I get an error when I used the magic link page to login.

The message in Xano:

Even though the magic-link is not created, part of the login process works, e.g. a value is created in the magic_link record for that user:

I confirmed that the following values re all correct:

Sendgrid API key
Sendgrid magic link template
magic jwt secret

I ran the API /auth/magic-link and checked all the variables in the debugger:

They all have data, except the output at step 1.9:

Any suggestions how this problem is being caused?

Tagged:

Best Answer

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    edited June 2023 Answer ✓
    Options

    Hi @Mr_English ! 👋

    Thank you for the warm welcome!

    So it looks like the error "Magic link could not be created. Try again." is being returned from Step 2 in the function stack of the /auth/magic-link endpoint. This error is being returned because the variable magic_link is null (not being generated).

    Now, we can dive into the generate_magic_link custom function to see where the variable magic_link is coming from.

    As you saw in the debugger, step 1.9 is not creating the magic_link. The value for the magic link is the environment variable magic_link_redirect_uri concatenated with the variable jwt (coming from the step 8).

    This might be a good spot to start debugging. Make sure that both the environment variable magic_link_redirect_uri and magic_jwt_secret are correct under your workspace settings

    Also, I just ran through the video and instructions included in the Market place for using Magic Link With Sendgrid. I was able to run everything successfully, but I found myself going back and forth between reading the instructions and watching the video to ensure everything was implemented correctly. If you haven't gone through the written instructions, I highly recommend doing so.

Answers