Overview
Null Pass uses JWT (JSON Web Tokens) for authentication. After successful registration or login, you’ll receive a JWT token that must be included in subsequent API requests.Authentication Flow
1
Register or Login
Users register with email and password, or login with existing credentials. If 2FA is enabled, an additional verification step is required.
2
Receive Token
Upon successful authentication, you receive a JWT token. Store this securely in your application.
3
Include in Requests
Include the token in the Authorization header for all protected endpoints:
4
Token Expiration
Tokens expire after 7 days. Implement token refresh logic or prompt users to log in again.
Token Format
Tokens are standard JWT tokens that contain user information:Two-Factor Authentication
Null Pass supports TOTP (Time-based One-Time Password) for enhanced security. When 2FA is enabled:- User logs in with email and password
- API responds with
requires2FA: trueand apendingToken - User provides verification code from authenticator app
- API validates code and returns full authentication token
Enable 2FA
Learn how to enable two-factor authentication
Login with 2FA
See how to handle 2FA during login
Session Management
Null Pass tracks user sessions for security and audit purposes. Each login creates a new session that:- Is tied to the user’s IP address (encrypted)
- Expires after 7 days
- Can be viewed and managed via the sessions API
Manage Sessions
View and delete active sessions
Security Best Practices
Store Tokens Securely
Store Tokens Securely
- Use secure storage (keychain, secure storage, environment variables)
- Never store tokens in localStorage for sensitive applications
- Consider using httpOnly cookies for web applications
Handle Token Expiration
Handle Token Expiration
- Implement token refresh logic
- Handle 401 responses gracefully
- Prompt users to re-authenticate when tokens expire
Use HTTPS
Use HTTPS
- Always use HTTPS in production
- Never send tokens over unencrypted connections
- Validate SSL certificates
Implement Rate Limiting
Implement Rate Limiting
- Respect rate limits on your end
- Implement exponential backoff
- Cache responses where appropriate