Authenticating Users via Magic Link
This guide assumes you have already followed the Setup Guide and have set up the Alchemy Account Provider using this guide. Please refer to the guides above for more information on how to properly setup your project.
For a complete example of how we can setup a project and use the various available authentication methods, please refer to our quickstart example.
Set the Email Mode to Magic Link
in your Account Kit Dashboard
In your Alchemy Accounts Dashboard:
-
Navigate to the Smart Wallets tab
-
Select the config you would be using for your project and click the Edit button
-
Scroll down to the Email Mode options in the Email section and select Magic Link
-
Click the Save Changes button
Send an Email Magic Link to a User
To send an email magic link to a user, you can use the authenticate()
function from the useAuthenticate()
hook with the type
set to email
and the emailMode
set to magicLink
.
Authenticate User via Deep Link
When a user clicks on the magic link in their email, it should deep link to your app if this has been setup correctly.
A bundle
parameter present in the deep link url will be used to authenticate the user and save the user’s session.
Here’s an example of what this might look like: