[GH-ISSUE #6001] How to Configure Auth for System-Generated Credentials Instead of Email/Password? #10397

Closed
opened 2026-04-13 06:30:37 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @devcedrick on GitHub (Nov 15, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/6001

My web project is not using the traditional authentication setup in which users are required to provide their email and password. Instead, my web app is using username and password which are both generated by system. How can I setup this in auth.ts?

Originally created by @devcedrick on GitHub (Nov 15, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/6001 My web project is not using the traditional authentication setup in which users are required to provide their email and password. Instead, my web app is using username and password which are both generated by system. How can I setup this in auth.ts?
GiteaMirror added the locked label 2026-04-13 06:30:37 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Nov 15, 2025):

Thanks for opening an issue! To support system‐generated credentials instead of the usual email/password signup flow, you can customize your sign‐up process. One approach is to let your backend generate both the username and password and then call the built‐in signup function (for example, the signUp.email method) with those generated values rather than user-entered inputs. This means you’d disable or hide the default input form on the frontend and instead expose a custom API endpoint that handles credential generation and securely delivers them to your users (e.g., via email or another trusted channel) [1].

You may also consider extending or creating a custom plugin to encapsulate this behavior if it needs to integrate seamlessly with your overall auth flow. Have you already defined how you’d want to distribute the generated credentials to your users?

tag @better-auth-agent if you would like an answer from the Agent

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3536160387 --> @better-auth-agent[bot] commented on GitHub (Nov 15, 2025): Thanks for opening an issue! To support system‐generated credentials instead of the usual email/password signup flow, you can customize your sign‐up process. One approach is to let your backend generate both the username and password and then call the built‐in signup function (for example, the signUp.email method) with those generated values rather than user-entered inputs. This means you’d disable or hide the default input form on the frontend and instead expose a custom API endpoint that handles credential generation and securely delivers them to your users (e.g., via email or another trusted channel) [[1]](https://www.better-auth.com/docs/reference/contributing). You may also consider extending or creating a custom plugin to encapsulate this behavior if it needs to integrate seamlessly with your overall auth flow. Have you already defined how you’d want to distribute the generated credentials to your users? tag @better-auth-agent if you would like an answer from the Agent <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Author
Owner

@devcedrick commented on GitHub (Nov 15, 2025):

@better-auth-agent

Should I disable emailAndPassword?
`
export const whisprAuth = betterAuth({
emailAndPassword: {
enabled: false
},

});
`

<!-- gh-comment-id:3536173125 --> @devcedrick commented on GitHub (Nov 15, 2025): @better-auth-agent Should I disable emailAndPassword? ` export const whisprAuth = betterAuth({ emailAndPassword: { enabled: false }, }); `
Author
Owner

@better-auth-agent[bot] commented on GitHub (Nov 15, 2025):

Hi there! If you’re not using traditional email/password authentication because your system generates credentials automatically, you have a couple of approaches:

• Disabling the emailAndPassword strategy (as shown in your snippet) is fine if you’re confident that your custom flow will fully handle authentication. However, note that Better Auth doesn’t currently provide a built‐in system-generated credentials provider, so you’ll need to implement your own login and registration logic.

• Alternatively, you could keep emailAndPassword enabled and override the sign-up or sign-in behavior to automatically assign system-generated credentials. This approach lets you leverage Better Auth’s existing session management and other features while substituting your custom user-creation logic.

Our documentation on authentication flows and plugin customization hints at these kinds of adjustments [1] [2]. What approach sounds better for your project—fully custom logic with the strategy disabled or an overridden flow on top of the base email/password configuration?

tag @better-auth-agent if you would like an answer from the Agent

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3536173362 --> @better-auth-agent[bot] commented on GitHub (Nov 15, 2025): Hi there! If you’re not using traditional email/password authentication because your system generates credentials automatically, you have a couple of approaches: • Disabling the emailAndPassword strategy (as shown in your snippet) is fine if you’re confident that your custom flow will fully handle authentication. However, note that Better Auth doesn’t currently provide a built‐in system-generated credentials provider, so you’ll need to implement your own login and registration logic. • Alternatively, you could keep emailAndPassword enabled and override the sign-up or sign-in behavior to automatically assign system-generated credentials. This approach lets you leverage Better Auth’s existing session management and other features while substituting your custom user-creation logic. Our documentation on authentication flows and plugin customization hints at these kinds of adjustments [[1]](https://github.com/better-auth/better-auth/issues/4125) [[2]](https://www.better-auth.com/). What approach sounds better for your project—fully custom logic with the strategy disabled or an overridden flow on top of the base email/password configuration? tag @better-auth-agent if you would like an answer from the Agent <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Author
Owner

@devcedrick commented on GitHub (Nov 15, 2025):

@better-auth-agent

I am planning to use Supabase Database, how can I implement it?

<!-- gh-comment-id:3536177924 --> @devcedrick commented on GitHub (Nov 15, 2025): @better-auth-agent I am planning to use Supabase Database, how can I implement it?
Author
Owner

@better-auth-agent[bot] commented on GitHub (Nov 15, 2025):

Hi there! It looks like you want to move away from the traditional email/password flow and instead use system-generated username and password credentials while connecting to a Supabase database.

Here’s a suggested approach:

• In your auth.ts file, configure your Better Auth instance by providing your Supabase connection details via the database property. This connection is set up similarly to how you’d configure other PostgreSQL databases. You’d supply your Supabase connection string using your preferred database adapter [1].

• Since you’re not using typical email/password authentication, you can disable or adjust that option. Instead, you’ll need to customize your sign-up flow. One common way is to implement a custom endpoint (or use a plugin if there’s one available) that generates a unique username and a system-generated password. Once generated, store these credentials directly in your database and then invoke Better Auth’s sign-in methods programmatically to create the session. This helps ensure that authentication is still handled securely while you’re in control of credential generation [2].

• Verify that your custom flow integrates with Better Auth’s hooks, especially if you need to handle things like session creation, token generation, or any additional security measures. This will ensure seamless integration of your system-generated credentials with the rest of the Better Auth workflow.

Does this help clarify your next steps? Let me know if you need further details or additional assistance configuring your custom endpoint or Supabase integration. Tag @better-auth-agent if you would like an answer from the Agent.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3536178126 --> @better-auth-agent[bot] commented on GitHub (Nov 15, 2025): Hi there! It looks like you want to move away from the traditional email/password flow and instead use system-generated username and password credentials while connecting to a Supabase database. Here’s a suggested approach: • In your auth.ts file, configure your Better Auth instance by providing your Supabase connection details via the database property. This connection is set up similarly to how you’d configure other PostgreSQL databases. You’d supply your Supabase connection string using your preferred database adapter [[1]](https://www.better-auth.com/docs/reference/contributing). • Since you’re not using typical email/password authentication, you can disable or adjust that option. Instead, you’ll need to customize your sign-up flow. One common way is to implement a custom endpoint (or use a plugin if there’s one available) that generates a unique username and a system-generated password. Once generated, store these credentials directly in your database and then invoke Better Auth’s sign-in methods programmatically to create the session. This helps ensure that authentication is still handled securely while you’re in control of credential generation [[2]](https://github.com/better-auth/better-auth/issues/4125). • Verify that your custom flow integrates with Better Auth’s hooks, especially if you need to handle things like session creation, token generation, or any additional security measures. This will ensure seamless integration of your system-generated credentials with the rest of the Better Auth workflow. Does this help clarify your next steps? Let me know if you need further details or additional assistance configuring your custom endpoint or Supabase integration. Tag @better-auth-agent if you would like an answer from the Agent. <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Author
Owner

@bytaesu commented on GitHub (Feb 1, 2026):

Hi @devcedrick,

I think the username plugin would fit your use case
If you have any further questions, feel free to mention me 😄

https://www.better-auth.com/docs/plugins/username

<!-- gh-comment-id:3830686421 --> @bytaesu commented on GitHub (Feb 1, 2026): Hi @devcedrick, I think the `username` plugin would fit your use case If you have any further questions, feel free to mention me 😄 https://www.better-auth.com/docs/plugins/username
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10397