Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for registration to magic link strategy #554

Closed
Darth-Knoppix opened this issue Jan 24, 2024 · 2 comments · Fixed by #796
Closed

Add support for registration to magic link strategy #554

Darth-Knoppix opened this issue Jan 24, 2024 · 2 comments · Fixed by #796

Comments

@Darth-Knoppix
Copy link

Context

This originally came from https://elixirforum.com/t/using-magic-links-for-registration/61166. It may also require changes to Ash Authentication Phoenix.

Problem

The magic link strategy doesn't support registration. It can only be used to sign in existing users/resources.

Why?

It's not possible to use the magic link strategy as a primary form of auth, you still need another strategy for registration.

Possible Solution

Look at other strategies for inspiration and add a registration action (and anything needed to support it).

@jimsynz
Copy link
Collaborator

jimsynz commented Apr 9, 2024

I did some thinking about this. The way it currently works is that if you request a magic link it checks that the user exists, and then emails them a link. In order to continue working this way we'd have to change it to an upsert, which means we'd be creating user records for every address ever typed into the form.

I think the better solution is to generate a token without a subject and store the email address in the token resource until the token expires. That way we could upsert the user when the token is validated. This would be a bit of a change to the current behaviour, so I am keen for feedback before I try and dive in.

@Torkan
Copy link

Torkan commented May 15, 2024

The suggestion above sounds like the way to go!
Do you have a timeline on this one @jimsynz?

I'd love to be able to start using just magic links instead of requiring a password on registration as well 🙏 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants