h4nto
h4nto2mo ago

custom password provider

hello, does anyone know how to make a custom password provider using convex auth? just some basic stuff like using username instead of email, adding the possibility to change the password
4 Replies
Convex Bot
Convex Bot2mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
sshader
sshader2mo ago
https://labs.convex.dev/auth/config/passwords#customize-user-information might get you part of the way there -- swapping out email for username might be kind of involved since I think the current provider is geared towards email. https://github.com/get-convex/convex-auth/blob/main/src/providers/Password.ts is the existing implementation and shows some of the pieces you might want (e.g. modifyAccountCredentials for changing passwords)
GitHub
convex-auth/src/providers/Password.ts at main · get-convex/convex-a...
Library for built-in auth. Contribute to get-convex/convex-auth development by creating an account on GitHub.
Passwords - Convex Auth
Authentication library for your Convex backend
h4nto
h4ntoOP2mo ago
when calling this function what's the id field supposed to be? i've tried with the email, userId, accountId but always get a convex error saying "cannot modify account with ID X because it does not exist"
No description
No description
h4nto
h4ntoOP2mo ago
nvm, just solved it. i misspelled the provider (accidentally put a capital P in password) so basically i am using the default email field as a username instead, because there are no default validation checks for the email so i can just treat them as usernames because the logic is the same. users will signup, signin and visualize usernames even if in the db they are stored as email (not greatly intuitive but it works). and managed to handle password modification using the modifyAccountCredentials function ty ^^

Did you find this page helpful?