Authentication Flow
This sequence diagram shows the authentication flow for the TunnelFlight platform, including Google OAuth integration and session management.
OAuth Authentication Flow
Key Steps Explained
- User Initiates Login: User clicks login button on the WWW application
- OAuth Redirect: Application redirects to Google's OAuth service
- Google Authentication: User enters credentials on Google's secure login page
- Token Exchange: Google provides OAuth token back to the application
- Token Validation: API service verifies the token with Google
- User Management: System checks if user exists or creates new account
- Session Creation: Redis stores the session with expiry time
- JWT Generation: API creates JWT token for subsequent requests
- Authenticated State: User receives JWT and can access protected resources
Token Refresh Flow
Logout Flow
Security Considerations
- Token Expiry: Access tokens expire after 15 minutes, refresh tokens after 7 days
- HTTPS Only: All authentication traffic must use HTTPS
- Session Storage: Sessions stored in Redis with automatic expiry
- Rate Limiting: Login attempts are rate-limited to prevent brute force
- CSRF Protection: State parameter used in OAuth flow to prevent CSRF attacks