🚨 Pay Just $95/Year (Save 50%)β€”Black Friday Deal!

#97 PASSWORDLESS login with MAGIC LINK

16/11/2022
authentication
  • Demo how magic link login works
  • install gem Passwordless
  • sign in flow, find or create user
  • missing host to link to
  • click on link to sign in, link to sign in and sign out
  • fix Turbo errors
  • customize magic link Email
  • gem letter_opener to preview emails
  • authorization - only logged in users can edit posts
  • Summary

Passwordless authentication via magic link is an interesting alternative to email-password authentication solutions like Devise.

A passwordless authentication flow looks like this:

  1. Enter your email address
  2. Receive login link in an email
  3. Click link = You are logged in!

I’ve implemented passwordless authentication in insta2blog.com, and for now I am super happy with the solution πŸš€. Feel free to try it out!

In a way this is a more secure authenication strategy, because there is no compromised password point of failure. It is as secure as your email account.

However to even start using this solution in production, you will need to set up sending emails in production.

It is not hard to create this kind of authentication solution on your own, however I prefer not to reinvent the wheel. Gem passwordless neatly solves the problem.

Episode source code: https://github.com/corsego/97-passwordless-auth/commit/34517fddf74572308780c1593ef23c0c85872301
Text version: https://blog.corsego.com/gem-passwordless-magic-link-auth

0:00 Demo how magic link login works
1:29 install gem Passwordless
7:05 sign in flow, find or create user
9:13 missing host to link to
11:30 click on link to sign in, link to sign in and sign out
13:50 fix Turbo errors
16:11 customize magic link Email
17:11 gem letter_opener to preview emails
18:27 authorization - only logged in users can edit posts
19:47 Summary

1
Sign in to join the conversation