Delay in updating user fields #637
-
When updating the user displayName for instance: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Quick answer: After updating the Firebase user's name, call This behavior is currently expected. Right now, the AuthUser value is only updated on the client when the ID token changes (see: One reason this is good is that it will keep the server-side and client-side AuthUser in sync. On the server side, the More information on refreshing claims from Firebase docs:
I recommend that, after updating the Firebase user's name, you call It's possible there's a smoother way to handle this kind of change. Any suggestions welcome! Edited to provide more detail. |
Beta Was this translation helpful? Give feedback.
Quick answer: After updating the Firebase user's name, call
AuthUser.getIdToken(true)
to force a token refresh, which will update claims and theAuthUser.displayName
value.This behavior is currently expected. Right now, the AuthUser value is only updated on the client when the ID token changes (see:
useFirebaseUser
,withAuthUser
). Changes to things like display name will not automatically update the AuthUser.One reason this is good is that it will keep the server-side and client-side AuthUser in sync. On the server side, the
displayName
value relies on the Firebase ID token's claims (source), and changes to claims are not automatically propagated to the client. If the ID token isn't re…