Authentication configuration controls how users authenticate with your Feathers application. It supports JWT tokens, local authentication (email/password), and OAuth providers.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/feathersjs/feathers/llms.txt
Use this file to discover all available pages before exploring further.
Configuration Location
Authentication settings are stored inconfig/default.json and generated when you run the authentication generator:
Authentication Schema
The authentication configuration can be validated using schemas:Core Settings
The secret key used to sign and verify JWT tokens. This should be a long, random string.Environment Variable:
FEATHERS_SECRETSecurity: Never commit this to version control. Always use environment variables in production.Example: Generated automatically as a 32-character base64 stringThe name of the entity (e.g., ‘user’) that is authenticated. Set to
null for no entity.Default: The service name (e.g., user)The name of the id property on the entity.Default:
id (or _id for MongoDB)The path of the service that provides the authentication entity.Example:
usersList of authentication strategy names that are allowed to create JWT access tokens.Default:
['jwt', 'local']Common values: jwt, local, google, github, facebook, twitter, auth0List of strategy names that should parse HTTP headers for authentication information.Default: Same as
authStrategiesJWT Settings
Options passed to the JWT library for token generation and verification.
Configuration for JWT parsing from HTTP headers.
Local Authentication Settings
Configuration for email/password authentication.
OAuth Settings
Configuration for OAuth providers (Google, GitHub, Facebook, etc.).
Provider-Specific Settings
Each OAuth provider (google, github, facebook, twitter, auth0) has the same configuration structure:Configuration for a specific OAuth provider.
Configuration Examples
Usage in Application
The authentication service is automatically configured:src/authentication.ts
Testing Authentication
Test your authentication configuration:Best Practices
Use strong secrets
Use strong secrets
Generate strong, random secrets for JWT signing. Use at least 32 characters and store them in environment variables.
Set appropriate token expiration
Set appropriate token expiration
Balance security and user experience. Short-lived tokens (1-7 days) are more secure but may require more frequent logins.
Secure OAuth credentials
Secure OAuth credentials
Never commit OAuth client IDs and secrets. Use environment variables and restrict access to production credentials.
Use HTTPS in production
Use HTTPS in production
Always use HTTPS for authentication endpoints in production to prevent token interception.
Validate token audience
Validate token audience
Set the
audience field in JWT options to your application’s domain to prevent token misuse.Hash passwords properly
Hash passwords properly
Use BCrypt with appropriate salt rounds (10-12). Never store plain-text passwords.