Laravel: Go for Passwordless Authentication

Search for a command to run...

No comments yet. Be the first to comment.
In this series/category, I would share with you guys all of my exp and best practices, to build the awesome products
Hey guys, Today I'll share with you a tip that will skyrocket your production debugging workflow ๐ We're going to generate a unique ID for each request, which we can use the request ID to search for every related log of the given request ID. Thus, i...
Hey guys, An update after I posted the โLaravel Excel: How to append rows to an existing Excel fileโ a while back. This post will give you another solution and probably a better way to export that fits every case. Problems Previously, when trying to ...

Hey guys, An easy topic for today! Make something a default (e.g., category, product, campaign, etc). Letโs go with the categories table for the examples. Letโs say we only want one category to be the default one. And find out which is the optimal wa...
Hey guys, Probably a chapter 2 of this https://sethphat.dev/why-is-wordpress-still-an-awesome-cms blog post, haha. Here was the story: Iโve been spending like 2 days figuring out which CMS I want to use for my new blog (for my new hobby lol) Letโs se...

Hey guys, Well damn, it has been a while since my last post lol, lazy & busy. But here I am, back to write useful tips for yโall ๐ฅน Let us do some exporting tasks for today, using Laravel Excel to export XLSX (yeah CSV is so 2010 lol). But, append mo...

Hey guys, Recently, I just bought Herd PRO (a yearly subscription). Iโve been using the basic Herd since the first release. So, my latest work required interaction with S3 storage, there are several ways to achieve that in the local env: Use Cloud (...

Hey guys,
Authentication topic today ๐
We all know that Laravel ships the default Email & Password authentication for us. The good'ol traditional way.
However, it's 2024 now. By registering using Email & Password, then users have to verify their emails. It's way bad UX and reduces your sign-up rates.
The passwordless is here to save the day ๐
Sign-up user flow will be really fast, with fewer inputs (or even 0 inputs) ๐
The pain of remembering passwords is gone ๐ฅฐ
Save storage cuz we don't really store users' passwords (encrypted obviously) in our DB ๐ฅน
Verify the user's email in 1 go, 2 birds with 1 stone.
By utilizing Laravel Socialite, we can provide a quick sign-up/sign-in flow using:
GitHub
(or any awesome platform out there)
After users sign in, Laravel Socialite will give you some basic details: open id, full name, email, and profile picture.
Then simply do an upsert operation and Auth::login($user) to sign your user in ๐
For this, we only need users to input their email and their names, and then we are all good ๐น
For this, you might need to implement your own generated_magic_links table, e.g:
id
user_id
hash
You can create a temporary user with email_verified_at = NULL . Then send out the email using Laravel Mail feature.
On the user's first visit, you touch the email_verified_at , then log them in ๐ฅ
Easy right?
Send SMS (cost more lol)
Use TOTP (time-based one-time password as temporary password)
two-factor authentication method after logging in.My applications use Passwordless authentication, check out RenderPDF.io as an example ๐.
Using passwordless is really cool and hassle-free. Fewer inputs, a happier life.
Happy coding guys!