简体   繁体   English

Firebase 用户 - 无需重新登录即可更新个人资料

[英]Firebase User - updating profile without logging back in

I'm using Firebase Authentication on my flask web app, and I want users of my site to be able to update their profile information - for now just profile pictures.我在我的 Flask 网络应用程序上使用 Firebase 身份验证,我希望我网站的用户能够更新他们的个人资料信息 - 现在只是个人资料图片。

So, I have JavaScript function that takes the value of input field (photo url) and changes the photoURL field in Firebase.所以,我有 JavaScript 函数,它获取输入字段(照片 url)的值并更改 Firebase 中的 photoURL 字段。

It's working fine, however for it to take effect, the user has to re-log.它工作正常,但是要使其生效,用户必须重新登录。 Is there a way to update it without having to log out and log back in?有没有办法更新它而不必注销并重新登录?

Firebase Authentication communicates the user profile information as part of their ID token, which is loaded when they sign in and then automatically refreshed once per hour. Firebase 身份验证将用户配置文件信息作为其 ID 令牌的一部分进行通信,该令牌在他们登录时加载,然后每小时自动刷新一次。

You can force a refresh by calling User.reload() or User.getIdToken(true) .您可以通过调用User.reload()User.getIdToken(true)强制刷新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM