首页 > 解决方案 > Flutter Firebase Auth登录日志在没有用户登录的情况下触发

问题描述

正如标题所说,当我的应用程序运行时,我看到了奇怪的日志。我得到的第一个是

W/BiChannelGoogleApi( 3072): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@36d7eba
W/DynamiteModule( 3072): Local module descriptor class for com.google.firebase.auth not found.
I/FirebaseAuth( 3072): [FirebaseAuth:] Loading module via FirebaseOptions.
I/FirebaseAuth( 3072): [FirebaseAuth:] Preparing to create service connection to gms implementation
D/FirebaseAuth( 3072): Notifying id token listeners about user ( *useridhere* ).
D/FirebaseApp( 3072): Notifying auth state listeners.
D/FirebaseApp( 3072): Notified 1 auth state listeners.

然后稍后我得到

I/FirebaseAuth( 3072): [FirebaseAuth:] Loading module via FirebaseOptions.
I/FirebaseAuth( 3072): [FirebaseAuth:] Preparing to create service connection to gms implementation

这是我所期望的所有正常日志,所以我很好奇这是否会导致任何问题?确实看起来不太对。

编辑:

为了清楚起见,立即登录后我得到

W/DynamiteModule( 3072): Local module descriptor class for com.google.firebase.auth not found.
W/BiChannelGoogleApi( 3072): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@36d7eba
W/DynamiteModule( 3072): Local module descriptor class for com.google.firebase.auth not found.
I/FirebaseAuth( 3072): [FirebaseAuth:] Loading module via FirebaseOptions.
I/FirebaseAuth( 3072): [FirebaseAuth:] Preparing to create service connection to gms implementation
D/FirebaseAuth( 3072): Notifying id token listeners about user ( *useridhere*).
D/FirebaseAuth( 3072): Notifying auth state listeners about user ( *useridhere* ).
D/FirebaseApp( 3072): Notifying auth state listeners.
D/FirebaseApp( 3072): Notified 1 auth state listeners.

我知道这是正常的。但是,这发生在应用程序运行的中间,这似乎不正常

标签: firebasefirebase-authenticationflutter

解决方案


当您启动使用 Firebase 身份验证的应用时,它会自动尝试重新验证之前登录的用户。在这种情况下,似乎还有一个监听器来监听身份验证状态的变化(可能是 FlutterFire 本身),然后 Firebase 身份验证客户端会通知身份验证状态。


推荐阅读