Appearance
G.2: Login
Summary
Guests log in from /login using a Supabase magic link or OAuth provider. After authentication, the app resolves the current user profile and routes the user to onboarding or dashboard.
Role
- Primary: Guest
- Secondary: Client, Counselor, Admin, Supabase Auth
Entry Point
- URL:
/login
Preconditions
- Guest is not authenticated.
- Supabase Auth is available.
Steps
- Guest opens
/login. - Guest enters an email or selects an OAuth provider.
- Frontend requests a Supabase magic link or OAuth redirect.
- Guest completes authentication with Supabase.
- App initializes the Supabase session.
- Frontend requests the current Compath user profile.
- User is routed to
/onboardingif required, otherwise/dashboard.
Diagram
Edge Cases
- Already authenticated: Public-only routing redirects away from
/login. - Profile load failure: App shows retry state before routing.
- Return URL: Magic links can return users to the originally requested protected route.
Current Implementation Notes
- Frontend:
frontend/src/features/auth/components/login-form.tsx,frontend/src/app/providers/auth-provider.tsx - Route guard:
frontend/src/shared/components/layout/public-only-route.tsx
Screenshot Status
- Not captured.