Better-Auth Enchanced/Plugins
Username
This plugin provides advanced username validation and management for Better Auth. It allows users to sign in with a username and password and adds strong validation rules.
Installation
To use this plugin in your application, you need to register it in both client and server configurations.
Initialize plugin
Usage
To sign in with username:
To update username:
API
| Prop | Type | Default |
|---|---|---|
schema? | Record<string, any> | - |
transform? | (username: string) => string | (username) => username |
validator? | (username: string) => boolean | Promise<boolean> | /^[a-zA-Z0-9_.]+$/ |
maxUsernameLength? | number | 30 |
minUsernameLength? | number | 3 |
Error Codes
| Code | Description |
|---|---|
INVALID_USERNAME_OR_PASSWORD | Invalid username or password |
USERNAME_TOO_SHORT | Username is too short |
USERNAME_TOO_LONG | Username is too long |
INVALID_USERNAME | Invalid username format |
USERNAME_IS_ALREADY_TAKEN | Username is already taken |
EMAIL_NOT_VERIFIED | Email address is not verified |
Installation
Better-Auth Enhanced is a collection of plugins that extend the functionality of Better Auth. Follow the steps below to install and start using these plugins in your project.
Feedback
This plugin provides feedback collection and management for your Better Auth application. By default, authentication is required to submit feedback, but this can be configured.