nextauthjs / nextauthjs/next-auth

refetchInterval does not send "update" trigger

Open
#11,037 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug triage
Dominant language
TypeScript
Stars
28.4k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

Environment
  System:
    OS: macOS 14.3
    CPU: (12) arm64 Apple M2 Pro
    Memory: 2.55 GB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.18.0/bin/yarn
    npm: 10.3.0 - ~/.nvm/versions/node/v18.18.0/bin/npm
    pnpm: 8.7.6 - ~/.nvm/versions/node/v18.18.0/bin/pnpm
    bun: 1.1.8 - ~/.nvm/versions/node/v18.18.0/bin/bun
  Browsers:
    Chrome: 125.0.6422.78
    Safari: 17.3
Reproduction URL

https://github.com/sandervspl/next-auth-refetchinterval

Describe the issue

I might be misunderstanding the point of refetchInterval, but currently it does not pass a value to the "trigger" prop in the JWT callback. The update() function DOES have a "update" value on trigger in the JWT callback.

When I read the docs (https://next-auth.js.org/getting-started/client#refetch-interval) there is a link to an "alternative" option that uses the update() function to achieve the same thing. So my understanding is that refetchInterval should also fire with an "update" trigger, just like the update() function does.

How to reproduce
  1. Clone the repo
  2. npm install
  3. npm run dev
  4. go to http://localhost:3000/
  5. Login with any username
  6. Check the terminal for logs to see that the jwt callback is fired without a trigger (should be "update")
Expected behavior

I expect the JWT callback trigger to have a value of update when I read the docs.

Contributor guide

Open the contributing guide

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.

Research direction

Start with the linked reproduction repository and follow its refetchInterval setup, then inspect how the JWT callback receives the trigger during refetchInterval and update() calls. Confirm the behavior in the terminal logs and compare it with the documented expectation. Done means refetchInterval produces an "update" trigger consistently with update().

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, node.js, typescript
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.