Skip to main content

Authentication Flow

Dokumentasi lengkap tentang alur autentikasi di MStore Dashboard, termasuk login, token refresh, dan logout.

Overview

MStore Dashboard menggunakan JWT authentication dengan strategi keamanan tinggi:
  • Access Token: Disimpan di memory (Pinia store)
  • Refresh Token: HttpOnly cookie (set oleh backend)

Login Flow

Login Implementation

Token Refresh Flow

Token Refresh Implementation

Logout Flow

Logout Implementation

Route Protection Flow

Route Guard Implementation

Session Recovery Flow

Session Recovery Implementation

Complete Auth State Machine

Security Considerations

  • Access Token: Memory only (not localStorage)
  • Refresh Token: HttpOnly cookie
  • Never expose tokens to JavaScript
  • Access Token: 15-30 minutes
  • Refresh Token: 7-30 days
  • Auto-refresh before expiration
  • All auth requests over HTTPS
  • Secure flag on cookies
  • SameSite=Strict atau Lax
  • Refresh token dalam HttpOnly cookie
  • Origin validation di backend
  • SameSite cookie attribute

Error Handling

Next Steps

Core Authentication

Implementasi detail auth

API Interceptors

Auto-refresh implementation