需要不断检查 flutter 应用程序的身份验证类型
need to keep check the type of authenticatin for the flutter app
我已经通过 email/password 和 google 登录为 flutter 应用程序实施了 firebase 身份验证,两种类型的登录都成功 运行 并退出 email/password。
我有一个退出按钮,我应该如何检查登录是 google 登录还是 email/password 以便我可以处理相应的应用程序退出。
UserInfo 的每个 User object has a providerData array - each UserInfo element in that array represents one auth provider for that account (such as Google or email/password). Before signing out, simply iterate that array and check the providerId 找出用户用来登录的内容。您将不得不对提供商 ID 进行逆向工程,除非您可以在其他地方找到它们的列表。
我已经通过 email/password 和 google 登录为 flutter 应用程序实施了 firebase 身份验证,两种类型的登录都成功 运行 并退出 email/password。
我有一个退出按钮,我应该如何检查登录是 google 登录还是 email/password 以便我可以处理相应的应用程序退出。
UserInfo 的每个 User object has a providerData array - each UserInfo element in that array represents one auth provider for that account (such as Google or email/password). Before signing out, simply iterate that array and check the providerId 找出用户用来登录的内容。您将不得不对提供商 ID 进行逆向工程,除非您可以在其他地方找到它们的列表。