Skip to content

Limit frequency of calls to set auth cookie (optimization) #424

@alex-knyazev

Description

@alex-knyazev

Describe the bug
When you visit any page, onIdTokenChange function is called, so the token is changed.

I think this is redudant, we don't need to do update token on every page.

Versions

next-firebase-auth version: ^0.14.1-alpha.0,
Firebase JS SDK: 8.10.0
Next.js: 12.0.8

To Reproduce
Steps to reproduce the behavior:

  1. Go to any page which uses withAuthUser
  2. Then go to other page
  3. See in console - there is message Completed auth API request via tokenChangedHandler.

image

Expected behavior
Should be called only when token expired or user auth state changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions