【发布时间】:2021-01-05 10:02:16
【问题描述】:
我正在使用 Firebase Auth 插件对我的 Flutter 应用进行身份验证。
直到升级到最新的 Firebase 身份验证版本(不确定是否相关):
firebase_core: ^0.5.0
firebase_auth: ^0.18.0+1
一切正常。
现在我第一次遇到 Sentry 错误:
FirebaseAuthException: [firebase_auth/user-token-expired] The user's credential is no longer valid. The user must sign in again.
File "exception.dart", line 20, in catchPlatformException
File "zone.dart", line 1198, in _rootRunUnary
File "zone.dart", line 1100, in _CustomZone.runUnary
File "future_impl.dart", line 160, in _FutureListener.handleError
File "future_impl.dart", line 708, in Future._propagateToListeners.handleError
File "future_impl.dart", line 729, in Future._propagateToListeners
File "future_impl.dart", line 537, in Future._completeError
File "async_patch.dart", line 47, in _AsyncAwaitCompleter.completeError
File "platform_channel.dart", in MethodChannel.invokeMapMethod
File "<asynchronous suspension>"
File "unparsed"
怎么会这样?用户说,他有几天没用这个应用程序了。据我了解 Firebase 身份验证文档,身份验证令牌会自动使用刷新令牌进行刷新。
如何缓解这个问题?
我在哪里/如何捕获此异常以将用户重定向到登录屏幕?
【问题讨论】:
标签: firebase flutter firebase-authentication