Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh token implementation not working with multiple tabs open #974

Open
anjarupnik opened this issue Jan 2, 2025 · 0 comments
Open
Labels
bug A bug that needs to be resolved pending An issue waiting for triage

Comments

@anjarupnik
Copy link
Contributor

anjarupnik commented Jan 2, 2025

Environment

  • Operating System: Darwin
  • Node Version: v22.12.0
  • Nuxt Version: 3.14.1592
  • CLI Version: 3.16.0
  • Nitro Version: 2.10.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: default
  • Runtime Modules: ../src/module.ts
  • Build Modules: -

Reproduction

It can be easily reproduced by running playground-local

Describe the bug

Steps to reproduce:

  1. Run playground-local
  2. Sign in
  3. Open one more tab with the app
  4. Return to the previous one
  5. Error is thrown: ofetch.03887fc3.mjs?v=00ccaa94:316 Uncaught (in promise) FetchError: [POST] "/api/auth/refresh": 401 Tokens mismatch - this is not good at async Object.refresh
    I would expect that refresh would update token and refresh token in all the open tabs.
    As I workaround for my app I implemented custom refresh handler and when refresh occurs I trigger local storage event that enables me to reload and update other tabs (not sure if this is the best approach but it works).
    It would be nice if there would be solution for this in the package itself :)

Additional context

No response

Logs

No response

@anjarupnik anjarupnik added bug A bug that needs to be resolved pending An issue waiting for triage labels Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that needs to be resolved pending An issue waiting for triage
Projects
None yet
Development

No branches or pull requests

1 participant