capawesome-team / capacitor-firebase

⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the Web.
https://capawesome.io/plugins/firebase/
Apache License 2.0
397 stars 102 forks source link

feat: Add onIdTokenChanged Event #746

Closed ewwwgiddings closed 1 week ago

ewwwgiddings commented 1 week ago

Plugin(s)

Current problem

I want a way to handle when the token has been refreshed. Currently since version 4 the authStateChanged event does not handle this.

Preferred solution

As noted in the link in the Current Problem section I want the ability to use onIdTokenChanged

Alternative options

Set up some sort of timed refresh and set it after the result of that.

Is there a way to get the token that is stored locally in a cross platform way? That is what I am wanting to do and was seeing this as a solution for.

Additional context

As noted in the links above this functionality changed in version 4. This would be to add that functionality to all environments so that users can react to token refreshes as well as sign in and sign out.

I am finding that using the current methods available to get the current token is inconsistent across environments and/or requires an HTTP request to get the token.

Before submitting

ewwwgiddings commented 1 week ago

Relates to: https://github.com/capawesome-team/capacitor-firebase/discussions/745

ewwwgiddings commented 1 week ago

Closing because I didn't see this PR: https://github.com/capawesome-team/capacitor-firebase/pull/709