Ash FrameworkAF
Ash Frameworkβ€’2mo agoβ€’
18 replies
andresgutgon

UserIdentity for linking a logged user

Hi, I'm trying to connect an existing user that's already in the application with their providers. This would be the idea

1. User sign-in with password or magic link
2. We display all supported providers: Github, Google, ...
3. User clicks on one provider and the auth flow starts.

The normal use case for User identity is I think this

1. User sign-in with password or magic link myemail@gmail.com
2. Log out
3. Clicks on sign-in with Github where their email is the same myemail@gmail.com

This is what I have working in this repo
https://github.com/andresgutgon/ash_learning/pull/1

But I think the other use case is super interesting because allows existing users with someemail@hotmail.com connect their Github which they have linked to a different email myemail@gmail.com


The problem I encountered when I dig into this is that auth flow creates the user if it does not exists for that email.

So the app ends with 2 emails
1. someemail@gmail.com User sign-in with password
2. myemail@gmail.com User already inside the app is logout and new user is sign-in with this email

The problem is that I don't know how to hook before the user creation happens.

I think this is not possible with current implementation but let me know
Was this page helpful?