Skip to content

[FE-43] Set up auth Context/provider for session state #914

Description

@mftee

Overview

There is no client-side auth state anywhere. Every protected page needs to know the current user, whether they're authenticated, and how to log in/out.

Tech

React Context + a custom useAuth() hook, token persisted in memory + localStorage. No Zustand/Redux — Context is sufficient at this scope.

Acceptance Criteria

  • Create an AuthProvider wrapping app/layout.tsx exposing { user, accessToken, isAuthenticated, isLoading, login(), logout(), refresh() }
  • On mount, attempt to restore a session from a persisted refresh token before rendering protected content
  • login() calls POST /auth/login (or handles the OAuth redirect token per auth.controller.ts's redirectWithToken pattern) and populates state
  • logout() clears local state and persisted tokens
  • Exposes a useAuth() hook for consumption by pages/components

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions