Appearance
JWT Authorization
Alpha Fusion provides a simple JWT-based authentication setup. Connect it to your backend API to generate tokens and handle user authentication.
🛠 Core Implementation (app/core/)
🧩 AuthService
Manages signing in, signing out, and checking the current user's authentication status.🛡️ Guards
Protect routes by checking if a user is signed in.⚡ AuthInterceptor
Attaches the JWT token to request headers and handles 401 errors.
🚀 Setup Steps
🔗 Prepare Backend API
Implement endpoints for login, logout, and optionally token refresh.⚙️ Configure AuthService
Update the API endpoints inAuthServiceto connect to your backend.🔒 Use Guards
Apply route guards (AuthGuard) to secure routes that require authentication.
🗄️ Token Storage
Tokens are stored in localStorage by default. Protect your app against XSS, CSRF, and other attacks, as the JWT token can be accessed from the browser.
🔄 Refresh Token
If using refresh tokens, store them in HTTP-only cookies in the backend. Alpha Fusion does not handle refresh tokens on the frontend; they are managed entirely by your backend API.