Skip to content

feat(auth): add frontend role-based auth guards and session flow#6

Merged
ayacoders merged 1 commit intomainfrom
fac-web-05-student-faculty-views
Mar 1, 2026
Merged

feat(auth): add frontend role-based auth guards and session flow#6
ayacoders merged 1 commit intomainfrom
fac-web-05-student-faculty-views

Conversation

@ayacoders
Copy link
Contributor

Changes:

  • add frontend auth session utilities (localStorage token/refresh-token handling)
  • implement API auth middleware with:
    • bearer token injection
    • automatic refresh on 401
    • single retry with refreshed token
    • session clear + redirect to /auth on refresh failure
  • add auth API helpers/hooks (fetchMe, useMe, useRefresh, useLogout)
  • protect dashboard routes with auth/role guards
    • guard all dashboard routes behind authenticated /auth/me
    • restrict student routes to STUDENT
    • restrict faculty routes to FACULTY
    • redirect users with no roles to /auth
  • update auth page bootstrap/login flow to redirect by role after /auth/me
  • keep role routing focused on student/faculty for now
  • refresh OpenAPI/Kubb generated schema/types files from latest contract

- add frontend auth session utilities (localStorage token/refresh-token
handling)
- implement API auth middleware with:
    - bearer token injection
    - automatic refresh on 401
    - single retry with refreshed token
    - session clear + redirect to /auth on refresh failure
- add auth API helpers/hooks (fetchMe, useMe, useRefresh, useLogout)
- protect dashboard routes with auth/role guards
    - guard all dashboard routes behind authenticated /auth/me
    - restrict student routes to STUDENT
    - restrict faculty routes to FACULTY
    - redirect users with no roles to /auth
- update auth page bootstrap/login flow to redirect by role after
/auth/me
- keep role routing focused on student/faculty for now
- refresh OpenAPI/Kubb generated schema/types files from latest contract
@ayacoders ayacoders merged commit 69e52ce into main Mar 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant