Click here for a link to the most useful commit
This repo is a reference for setting up a comprehensive Magic Link solution in Phoenix, based off of Phoenix's
phx.gen.auth
generator. This reference will be useful for you, assuming that:
- You have started a new Phoenix project, or have an existing one.
- You have ran the
phx.gen.auth
generator (this project assumes you ranmix phx.gen.auth Users User users
, but you can adjust the context or schemas accordingly). - You want to add sign-in with magic links.
- You do not want any password handling code left over. Your app will only use emails (but maybe you want to add social auth or something, but not passwords).
The best way to use this as a reference would be to just refer to this commit. This has all the changes you need to implement in your own project. You can refer back to this commit as a starting point in new projects.
This work is an extension of this post. I like what @JohnElmLabs showed off in this post, but I wanted to extend it and show the result, in particular showing what you can remove from the authentication generator.