Skip to content

Token Storage and State Mismatch #248

@0marSalah

Description

@0marSalah

Summary:

  • Inconsistent token key usage between Redux and localStorage:
    • src/redux/slices/auth.ts → getLocalStorage('auth')
    • src/tools/auth.ts → ACCESS_TOKEN_KEY = 'auth'
    • src/App.tsx → getLocalStorage('auth')
  • If Redux update fails after token exchange (e.g., Google login), user appears logged-in locally but Redux state disagrees.
  • No error handling if localStorage write fails.

Impact:
Leads to ghost sessions and UI desync.

Suggested Fix:
Centralize token handling (single key constant + wrapper utility) and synchronize Redux + localStorage updates transactionally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions