AuthService
Component Detail
Service Layer
medium complexity
mobilefrontend
0
Dependencies
0
Dependents
0
Entities
0
Integrations
Description
The core authentication service that encapsulates all credential-based auth operations including registration, login, and password recovery. It communicates with the backend API, handles JWT token lifecycle, and provides a unified interface consumed by all auth screens. It is the single authoritative source for session state within the email/password flow.
auth-service
Sources & reasoning
Lines 42 and 319 both explicitly mark email/password as the MVP authentication method while deferring BankID and Vipps to Phase 2. Phase 1 = MVP by ordinal mapping. The feature is foundational - no other platform capability works without authenticated sessions.
-
docs/source/likeperson.md · line 42MVP leveres med e-post/passord-innlogging; BankID og Vipps ruller ut i Fase 2
-
docs/source/likeperson.md · line 319E-post/passord innlogging (BankID/Vipps i fase 2)
Responsibilities
- Authenticate users by sending credentials to the backend and returning a signed JWT
- Register new accounts by posting user data to the backend registration endpoint
- Trigger password reset emails and validate reset tokens on submission of a new password
- Expose the current authentication state and handle token refresh and expiry
- Propagate structured error codes (invalid credentials, account not found, weak password) to callers
Interfaces
login(email: string, password: string): Promise<AuthToken>
register(email: string, password: string): Promise<AuthToken>
requestPasswordReset(email: string): Promise<void>
confirmPasswordReset(token: string, newPassword: string): Promise<void>
logout(): Promise<void>
isAuthenticated(): boolean