Learn
>
Passport x Mailchain: How to Login with Web3 Magic Links

Passport x Mailchain: How to Login with Web3 Magic Links

February 25, 2023

Why might you want to do this?

Password-based authentication and ‘Login with Wallet’ can create security vulnerabilities and user friction. Magic links are an easy and fast way to create a secure authentication process for your users. Instead of users needing to sign data with a blockchain wallet, passwordless authentication with magic links for Passport.js improves the safety of users. Your users will have already proven they own the wallet address in Mailchain and can therefore take advantage of Mailchain’s account abstraction.

Key features include:

  • Users can signup and login to your application without passwords or needing to sign data with their wallets.
  • Mailchain supports magic links sent to ENS names, Ethereum addresses, Mailchain accounts and more
  • Passport handles secure token generation, expiration and confirmation.

Solution Overview

In this tutorial, we will build a todo list app, complete with functionality that allows users to sign in with Mailchain. By following along with this tutorial, you will learn how to use Passport for passwordless authentication using Mailchain to send magic links.

As we work through the tutorial, we'll be using Express as our web framework, along with EJS as our template engine and CSS for styling. We will use SQLite as our database for storing data. Don't worry if you are not familiar with these technologies -- the necessary code will be provided at each step.

You can find an example of the final result here https://github.com/mailchain/todos-express-mailchain on Github.

Tutorial

Follow the full steps for the tutorial here: https://docs.mailchain.com/developer/tutorials/integrations/passport-magic-link-tutorial/

Meet the writer

Misha Deville
Mailchain
Head of BD & Parnterships at Mailchain, Ex-AWS