Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GoodnessFx/GatePass/llms.txt
Use this file to discover all available pages before exploring further.
GatePass supports multiple authentication methods: Email/Password, OAuth (Google, Twitter), and Web3 Wallet authentication.
Authentication Methods
GatePass provides a flexible authentication system that supports both traditional and modern authentication methods:- Email/Password: Classic username and password authentication with bcrypt hashing
- Google OAuth 2.0: Social login via Google accounts
- Twitter OAuth 1.0a: Social login via Twitter accounts
- Web3 Wallet: Ethereum wallet-based authentication (coming soon)
JWT Token Flow
GatePass uses a dual-token authentication system for enhanced security:Access Token
Short-lived JWT token (15 minutes) used for API requests. Contains user ID, email, and role.
Token Structure
Email/Password Authentication
Registration
Create a new user account with email and password.Password Requirements: Minimum 8 characters with at least one uppercase letter, one lowercase letter, and one number.
Login
Authenticate an existing user.Refresh Token
Obtain a new access token using the refresh token.Google OAuth Integration
Integrate Google Sign-In for seamless authentication.Configuration
Set up Google OAuth credentials in your.env file:
.env
Implementation
Twitter OAuth Integration
Integrate Twitter Sign-In for social authentication.Configuration
Set up Twitter OAuth credentials:.env
Implementation
Twitter doesn’t always provide email addresses. Users may need to grant explicit permission or use email/password registration.
Protected API Requests
Include the access token in your API requests.Get Current User
Retrieve the authenticated user’s profile.Logout
Invalidate the current session and clear tokens.Security Best Practices
Token Storage
Store access tokens in
localStorage or sessionStorage. Never store refresh tokens in JavaScript-accessible storage.HTTPS Only
Always use HTTPS in production. Refresh tokens are set with
secure flag in production mode.Token Rotation
Implement automatic token refresh when access tokens expire. Use interceptors to handle 401 responses.
Password Validation
Enforce strong password requirements: minimum 8 characters with uppercase, lowercase, and numbers.
Environment Variables
Required environment variables for authentication:.env
Error Handling
Common authentication errors and their meanings:| Status Code | Error | Description |
|---|---|---|
| 400 | Invalid email format | Email validation failed |
| 400 | Password must be at least 8 characters | Password too short |
| 401 | Invalid email or password | Login credentials incorrect |
| 401 | Invalid refresh token | Refresh token expired or invalid |
| 409 | User already exists | Email or wallet address already registered |
For complete authentication flow implementation, refer to:
~/workspace/source/src/packages/server/src/routes/auth.ts~/workspace/source/src/packages/server/src/config/passport.ts~/workspace/source/src/packages/server/src/utils/auth.ts