且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

颤抖-如何保持用户使用Google登录

更新时间:2023-12-01 15:48:10

用户已经保持身份验证。重新启动应用程序后,Firebase从磁盘读取凭据,并刷新用户的令牌。由于这需要往返服务器,因此它是异步发生的。因此,请确保等待_auth.currentUser()来获取用户状态的通知。

Users already stay authenticated. After you restart the app, Firebase reads the credentials from disk, and refreshes the user's token. Since this requires a roundtrip to the server, it happens asynchronously. So be sure to await _auth.currentUser() to get notified of the user's status.

无论何时我想知道如何做这些事情,我看了 FlutterFire示例应用程序。可以在此处找到此行

Whenever I'm wondering how to do such things, I look at the FlutterFire sample app. This specific line can be found here.