Skip to content

Session and JWT callback is called twice with the SessionProvider #8152

@Natchii59

Description

@Natchii59

Environment

System:

  • OS: macOS 13.4.1
  • CPU: (8) arm64 Apple M1
  • Memory: 274.78 MB / 8.00 GB
  • Shell: 3.6.1 - /opt/homebrew/bin/fish

Binaries:

  • Node: 18.12.1 - ~/.local/share/nvm/v18.12.1/bin/node
  • npm: 8.19.2 - ~/.local/share/nvm/v18.12.1/bin/npm
  • pnpm: 8.6.7 - /opt/homebrew/bin/pnpm

Browsers:

  • Chrome: 115.0.5790.114
  • Safari: 16.5.2

Reproduction URL

https://github.com/Natchii59/next-chat

Describe the issue

I would like to update my JWT data, and for that I need to put the SessionProvider at the root of the page. To then use the useSession which gives access to the update function. The problem is that it creates 2 calls to the jwt and session callbacks each time the page is refreshed. How to fix this?

How to reproduce

Add a SessionProvider to the project and put a console.log in a NextAuth options callback.

Expected behavior

I wish I didn't have callbacks double call with a SessionProvider. Or another way to update my JWT data without using SessionProvider.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions