Overview
The authentication flow consists of:- Firebase handles user authentication (email/password, OAuth providers)
- Client obtains JWT token from Firebase
- Backend validates JWT token using Firebase Security Token Service
- User session is maintained via HTTP-only cookies
Backend Configuration
The backend uses JWT Bearer authentication configured insrc/PriceSignal/Program.cs:69-103.
JWT Bearer Setup
- Authority:
https://securetoken.google.com/YOUR_PROJECT_ID - Valid Issuer: Same as authority
- Valid Audience: Your Firebase project ID
- Token sources: Authorization header or
access_tokencookie
Frontend Configuration
Implement authentication provider
The AuthProvider handles all authentication operations and is defined in
src/features/auth/components/auth-provider.tsx.Supported authentication methods:- Email/Password
- Google OAuth
- Facebook OAuth
- Twitter OAuth
- GitHub OAuth
API Endpoints
POST /api/login
Establishes a user session and stores the JWT token in a secure cookie. Request:200 OK- Session established, user created if new400 Bad Request- Invalid user identifier
src/PriceSignal/Program.cs:162-189):
POST /api/logout
Clears the user session by deleting the authentication cookie. Request:200 OK- Session cleared
Token Management
The frontend automatically handles token refresh through Firebase’sonIdTokenChanged listener:
Security Considerations
- JWT tokens are validated against Firebase’s public keys
- Tokens are stored in HTTP-only cookies to prevent XSS attacks
- Cookies use
SecureandSameSite=Strictflags - Token lifetime is enforced by Firebase (typically 1 hour)
- Backend validates issuer, audience, and lifetime on every request
Next Steps
Creating Rules
Learn how to create price alert rules
Telegram Setup
Set up Telegram notifications for your alerts