mehedi
mehedi4d ago

how can I implement username/email and password auth?

I also want to allow users to enter username in email field while sign in or sign up
4 Replies
Convex Bot
Convex Bot4d 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!
erquhart
erquhart3d ago
Welcome! Are you using Clerk or Convex Auth, or something else? The easiest way to do auth in Convex is Clerk: https://docs.convex.dev/auth/clerk
mehedi
mehediOP3d ago
@erquhart I am using convex auth
erquhart
erquhart2d ago
I believe you would have to use the ConvexCredentials provider, which is barebones and requires you to provide your own authorize function. The Password provider implements ConvexCredentials, but in such a way that email is required. If I were trying to do username/password login, I would copy the Password provider and tweak it to work with usernames. Password Provider: https://github.com/erquhart/convex-auth/blob/e4a9e0e7de0da9160185ac0028cfb684a9bcd147/src/providers/Password.ts ConvexCredentials Provider: https://github.com/erquhart/convex-auth/blob/e4a9e0e7de0da9160185ac0028cfb684a9bcd147/src/providers/ConvexCredentials.ts cc/ @mikeysee I believe you've done this in the past, am I overcomplicating it?

Did you find this page helpful?