Invalid credentials after DB changes
I pretty much messed up the database by adding something into the schema, which caused some issues. Anyway, I ended up with a wiped database, the schema is now correct and working. I can sign up with a user, verify it however when trying to log in I am getting invalid credentials (I have tried different emails, passwords etc and 100% sure the password is correct.
I can see the user in the database, and when trying to log in can see this is the error coming up in the terminal [ Server ] POST /auth/email/login 401 72.864 ms - 43
2 Replies
Hi @MrPurpleHat. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It seems like you're experiencing an issue with the authentication process after making changes to your database schema. The
401
error you're seeing typically indicates unauthorized access, meaning the credentials provided are not matching the ones stored in the database.
One possible reason for this could be related to how passwords are hashed in Wasp. There was a breaking change between the old and the new auth in the way the password is hashed. This means that users will need to reset their password after the migration, as the old password will no longer work [source (https://wasp-lang.dev/docs/migrate-from-0-11-to-0-12#email)].
If you're sure that the credentials are correct, you might want to check the error messages returned by the server. There's an open issue on the Wasp GitHub page about providing more information during development when an error happens on the server, specifically for auth middleware [source (https://github.com/wasp-lang/wasp/issues/91)].
Also, ensure that your custom sign-up action is correctly implemented. The Wasp documentation provides an example of how to create a custom sign-up action [source (https://wasp-lang.dev/docs/auth/email#creating-a-custom-sign-up-action)].
If the issue persists, you might want to reach out to the Wasp community for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------Hm! Hard to say what happened without more information.
Can you do a password reset? This is all hapenning locally, right? What if you create anew user -> can you log in with that one?