Service Layer medium complexity Shared Component mobile
3
Dependencies
1
Dependents
4
Entities
0
Integrations

Description

BLoC-based service that orchestrates the email and password authentication flow against the REST API. Submits credentials to POST /api/v1/auth/login, handles the JWT token response, and delegates token persistence to Token Storage. Also manages token refresh via POST /api/v1/auth/refresh through the REST API client interceptor.

Feature: Email & Password Login

auth-service

Responsibilities

  • Submit email and password credentials to POST /api/v1/auth/login and handle response
  • Parse JWT access token and refresh token from API response
  • Coordinate with Token Storage to persist tokens securely after successful login
  • Trigger token refresh flow and propagate authentication state changes to the UI layer
  • Handle logout by clearing stored tokens and invalidating the server session

Interfaces

login(String email, String password) Future<AuthResult>
logout() Future<void>
refreshToken() Future<String>
getCurrentUser() Future<User?>
isAuthenticated() bool
getAccessToken() String?
onAuthStateChanged Stream<AuthState>

Relationships

Dependencies (3)

Components this component depends on

Dependents (1)

Components that depend on this component