Sounds like you are on the right track. If in doubt, take a look at how the packages are doing it, if it's the same way then you are on the right track ;)
@vincent15000 Your path is the one I'd follow unless I needed additional features the one of the many magic packages provide. Be sure to write a test for it too!
@Braunson To have a more secure passwordless authentication, some authentication services identify the device or the location of the user when he logs in (and the user receives an email to notify that somebody he has logged in from a new device / location).
How is it possible to retrieve the device / location of a user ?
Only via some headers like the User-Agent or via an API to locate a user by his IP address ?
@vincent15000 Are you worried that the magic link will be shared outside the user it's emailed to? I think if you want to track sessions, take a look at Laravel Jetstreams Browser Sessions in the GitHub repository for how to do that. Then if you implement that, you can just have an event and listener for user login that emails that user if they are logging in from a new device/location?
If you wanted to be specific with device/location, you'll need to track the device, IPs and use a third party to determine the location of the IPs as some people have changing IPs depending on their ISP.
I'd stick with the Magic link to start and integrate Browser Sessions personally unless there's a business/compliance requirement for the extra features you've mentioned.
@vincent15000 Same thing could be said about 2FA via Email or Text, it can be intercepted. I'd still defer to my previous comment about manually tracking device/browser/IP in the DB to match the login as "familiar device/user" OR you can embed it in the signed link and check against that information once you decode the signed link.
@vincent15000 as I said before, if your email is not secure then you may as well go to the country and become a farmer.
At the end of the day, virtually ALL access controls and account recovery reduce to sending the user an email.
If you want to detect when the user connects from an unknown device then the best solution is to give their device a cookie. If they login from a device with no cookie present then you can provide some additional challenge like asking to confirm something they know that they previously shared with you.
I imagine the most secure way to authenticate a user with a magic link is by sending the temporary signed link to the user to the email address saved in the database. Jeffery Way published his larabit on youtube on making a passwordless authentication system which does what you are looking for doing. Maybe you could get some ideas from his video. He uses Breeze and modifies it to work like what you described.