Email modification for auth
Hi! I have set up the email connexion on my app and I would like to let the user changer the email associate with his account. Change the user table is not a probleme but the user can't login with this new email.
Wasp version 16
5 Replies
Hi @Freelancer. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I understand you're trying to implement email change functionality in your Wasp app, but you're facing issues with users being unable to login with their new email addresses.
Currently, Wasp doesn't directly support changing the email address associated with an authentication identity. This is because in Wasp's auth system, the email is stored as the
providerUserId
in the AuthIdentity
entity, which forms part of the primary key for that entity.
When a user changes their email, you would need to update not just the User entity, but also the corresponding AuthIdentity record. However, Wasp doesn't currently provide a built-in way to do this.
This limitation is related to Wasp's current auth system design. Wasp is planning to introduce an account merging feature in the future that would make handling multiple auth identities (and potentially changing them) more straightforward.
For now, a potential workaround would be to:
1. Create a new AuthIdentity with the new email
2. Delete the old AuthIdentity
3. Update the User entity
However, this would require custom implementation and careful handling of the auth system internals, which might be complex and prone to errors.
If you need this functionality urgently, you might want to consider creating a custom solution or waiting for the account merging feature to be implemented in a future Wasp version.
I hope this helps clarify the current limitations. Let me know if you have any other questions about Wasp's auth system!
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Freelancer, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?I think we don't currently support changing the email address for a user, but you can probably implement it yourself copying the code from our custom signup action example.
I'll ping @miho in case we have some example code more readily available.
We'll need more information to be able to help, you said:
Change the user table is not a probleme but the user can't login with this new email.So, you have written some code to modify the email? Can you share that code with us here. What kind of problem do you face when trying to login?
@miho i think they might be changing the email in their Prisma model, but not in the AuthIdentity table
Yep, could be that 🙂 let's verify that with the user