First Sign In

What's the best hook to catch first sign in of a user ?
5 Replies
daveycodez
daveycodez3w ago
Whats the goal
Armand
ArmandOP3w ago
Hi @daveycodez , In my application, there’s no sign-up users must be invited. To handle this, I create a pending User and an associated Invitation. When the user accesses the invitation, they set up their email and password, which updates both the User and the Invitation status. Now, I’m adding OAuth with Microsoft as a provider. However, I still don’t want sign-up process, users should only be able to sign in to an already invited account (matching their email). What I'm trying to achieve is adding this new provider on the invitation page so the user can choose between Email & Password or Microsoft . If he choose OAuth I use signIn.social then I would like a callback / hook to update the User and Invitation status to set the User as valid and Invitation used etc... Additionally, an invited user can sign in directly via Microsoft OAuth, even without using the invitation link.
Snilzo
Snilzo3w ago
I have the same question, how do you map a hook to a first sign-in using social since its the same ctx path 😢 Found it, you can use databaseHooks -> user -> create
Armand
ArmandOP3w ago
This will trigger on sign-up not sign-in ? In my case I can use databaseHooks -> session -> create since the user already exist
Snilzo
Snilzo3w ago
Not sure if session create is not triggered when old session experied new one is setup you'll have to try

Did you find this page helpful?