Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Log out and go to the login page when the session expires

Open
#66 2 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@ayushnandi718-dev is already working on this.

Since Oct 21, 2026.

Assessment

This issue has not been assessed yet.

Description

bug difficulty: medium frontend hacktoberfest help wanted
Context

Login tokens expire after a while. When that happens, the API answers with 401, and client/src/utils/api.js removes the token from localStorage, but that's all. The app still thinks the user is logged in. They stay on the page, every action silently fails, and they only end up on the login page after reloading.

Files likely involved
  • client/src/utils/api.js (the response interceptor)
  • client/src/context/AuthContext.jsx (logout)
Acceptance criteria
  • When any request returns 401 while the user is logged in, the app logs them out (the same as clicking Logout), goes to /login, and shows the toast "Your session has expired. Please log in again."
  • A wrong password on the login page must not trigger this. POST /auth/login also returns 401 for wrong credentials, so that case keeps showing "Invalid email or password." as today.
  • Several requests failing at the same moment cause one logout and one toast, not several.
  • Avoid importing React code into api.js. One clean way is for api.js to accept a callback (for example setUnauthorizedHandler(fn)) that AuthContext registers.
How to test
  1. Log in, then in DevTools → Application → Local Storage, change the token value to something invalid.
  2. Click around (open Tasks, create a task): you're sent to the login page once, with the "session expired" toast.
  3. On the login page, enter a wrong password: the normal error shows, with no redirect and no "session expired" toast.

New here? 👋 Comment below to ask to work on this issue, and wait to be assigned. Then follow CONTRIBUTING.md for setup and how to open a pull request. Questions are welcome in the comments or in Discussions.

Dominant language
JavaScript
Stars
3
Forks
2
Avg merge
6h 50m
Merged PRs (30d)
37

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from KEX-03/taskflow

All issues in KEX-03/taskflow

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.