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

Plugin needs to expose an IDTokenDidChangeListener to capture new tokens #831

Closed
doginthehat opened this issue Sep 12, 2023 · 1 comment
Closed

Comments

@doginthehat
Copy link

doginthehat commented Sep 12, 2023

Feature request

The current implementation of the plugin has a method registerAuthStateChangeListener which exposes an authStateDidChangeListener via internal -addAuthStateDidChangeListener:.

The documentation for this event handlers specifies:

Registers a block as an “auth state did change” listener. To be invoked when:

The block is registered as a listener,
A user with a different UID from the current user has signed in, or
The current user has signed out.

However this does not trigger when a user token is auto refreshed.

This seems to require an IDTokenDidChangeListener.

The documentation for the method to add a hander addIDTokenDidChangeListener: states:

Registers a block as an “ID token did change” listener. To be invoked when:

The block is registered as a listener,
A user with a different UID from the current user has signed in,
The ID token of the current user has been refreshed, or
The current user has signed out.

It's basically the same as auth state but with the extra token refresh.

And unfortunately, without this handler, it's not possible to detect that a user token has been automatically refreshed.

There's a very similar issue with the web sdk that has two separate handlers.

The plugin could expose a registerIDTokenDidChangeListener method that would work fairly similar to the existing auth state listener. Both handlers have similar signatures so would likely be just duplicating the existing functionality with different method signatures.

@dpa99c dpa99c closed this as completed in f2a5878 Nov 14, 2023
@dpa99c
Copy link
Owner

dpa99c commented Nov 14, 2023

This has been implemented - documentation for the new method is here

ADCrouch pushed a commit to ADCrouch/cordova-plugin-firebasex that referenced this issue Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants