You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
firebase().auth().currentUser property stores the User object on a successful sign-in as expected. But it keeps storing the user object after signing out. currentUser getter returns the first signed-in user even after signing in to another user account.
⚠️ Because of firebase().auth().currentUser.getIdToken() returns the first user's token; It causes the 2nd user to use the first user's id token when hitting API endpoints.
Steps to reproduce
Sign in (Account A)
console.log(firebase().auth().currentUser)// User (Account A)console.log(firebase().auth().native.getCurrentUser())// [Android] Native user (Account A)console.log(firebase().auth().native.currentUser)// [IOS] Native user (Account A)
Sign out (Account A)
console.log(firebase().auth().currentUser)// Still has the user data of Account A [BUG]console.log(firebase().auth().native.getCurrentUser())// [Android] nullconsole.log(firebase().auth().native.currentUser)// [IOS] null
Sign in (Account B)
console.log(firebase().auth().currentUser)// Still has the user data of Account A [BUG]console.log(firebase().auth().native.getCurrentUser())// [Android] Native user (Account B)console.log(firebase().auth().native.currentUser)// [IOS] Native user (Account B)
The text was updated successfully, but these errors were encountered:
firebase().auth().currentUser
property stores theUser
object on a successful sign-in as expected. But it keeps storing the user object after signing out.currentUser
getter returns the first signed-in user even after signing in to another user account.firebase().auth().currentUser.getIdToken()
returns the first user's token; It causes the 2nd user to use the first user's id token when hitting API endpoints.Steps to reproduce
The text was updated successfully, but these errors were encountered: