-
-
Notifications
You must be signed in to change notification settings - Fork 0
Environment Variables
This page explains all environment variables used by SecureAuth.
Environment variables are required for authentication, encryption, cloud storage, and external service integrations.
Create a .env file in the root directory of the project.
Example:
# ===============================================
# SecureAuth Environment Configuration
# ===============================================
APP_NAME="SecureAuth"
APP_URL="http://localhost:3000"
PORT=3000
# ===============================================
# TEXTSNAP CONFIGURATION
# ===============================================
TEXTSNAP_INSTANCE_ID="YOUR_INSTANCE_ID"
TEXTSNAP_ACCESS_TOKEN="YOUR_ACCESS_TOKEN"
# ===============================================
# FIREBASE CONFIGURATION
# ===============================================
FIREBASE_DATABASE_URL="YOUR_FIREBASE_DATABASE_URL"
FIREBASE_DATABASE_SECRET="YOUR_FIREBASE_DATABASE_SECRET"
# ===============================================
# SECURITY CONFIGURATION
# ===============================================
JWT_SECRET="YOUR_SUPER_SECRET_KEY"
ENCRYPTION_KEY="YOUR_ENCRYPTION_KEY"Application display name.
Example:
APP_NAME="SecureAuth"Public application URL.
Used for:
- Redirects
- API callbacks
- PWA configuration
- Authentication validation
Example:
APP_URL="https://example.com"Port used by the backend server.
Example:
PORT=3000SecureAuth uses TextSnap for WhatsApp OTP delivery.
Your TextSnap instance ID.
Example:
TEXTSNAP_INSTANCE_ID="YOUR_INSTANCE_ID"Access token for TextSnap API authentication.
Example:
TEXTSNAP_ACCESS_TOKEN="YOUR_ACCESS_TOKEN"SecureAuth uses Firebase Realtime Database for secure cloud storage.
Firebase Realtime Database URL.
Example:
FIREBASE_DATABASE_URL="https://your-project.firebaseio.com/"Firebase database secret key.
Example:
FIREBASE_DATABASE_SECRET="YOUR_SECRET"These variables are critical for application security.
Used for JWT authentication and session validation.
Example:
JWT_SECRET="super_secure_random_secret"Used for encrypting sensitive authenticator data.
Example:
ENCRYPTION_KEY="strong_encryption_key"For production environments:
- Never expose
.envpublicly - Use strong random secrets
- Rotate credentials regularly
- Restrict database permissions
- Store backups securely
Changing this will invalidate all active sessions.
Changing this may make previously encrypted data unreadable.
Add .env to .gitignore
Example:
.envTo verify variables are loaded:
printenvor
cat .envError example:
Missing required environment variableSolution:
- Check
.envfile exists - Verify variable names
- Restart server after changes
Ensure database URL format is correct.
Example:
https://your-project.firebaseio.com/Check:
- TextSnap credentials
- Internet connection
- API limits
Continue with:
Secure • Fast • Modern ⚡
SecureAuth
Secure • Fast • Modern ⚡