首页 > 解决方案 > Firebase Google 登录不会添加用户

问题描述

我正在使用 Ionic 和 Capacitor 来开发 iOS 和 Android 应用程序。我正在尝试使用 Google 的 Firebase 进行社交登录。我遵循了一个教程,并将 Google 登录添加到我的应用程序中,这确实有效,但是用户(签名后没有出现在 Firebase 控制台的“身份验证”部分。我正在使用codetrix-studio/capacitor-google-auth",这就是我签署用户在:

async googleSignIn() {
  let googleUser = await Plugins.GoogleAuth.signIn();
  let user: User = {
      uid: googleUser.id,
      displayName: googleUser.name,
      email: googleUser.email,
      photoURL: googleUser.imageUrl
  }
}

我还看到在 Ionic 页面上有一个叫做 Firebase Authentication 的东西(看起来它是使用 Cordova 并且没有可用的 Capacitor 插件)。似乎它与电容器谷歌身份验证的目的相同,但我不太确定。

这是链接:https ://ionicframework.com/docs/v3/native/firebase-authentication/

不知道如何继续,我确实让谷歌登录工作,我让用户回来,但它不会出现在Authentication标签上。

标签: firebaseionic-frameworkcapacitor

解决方案


我已经设法使用Capacitor Firebase Auth Plugin完成这项工作。

为了支持 iOS 和 Android 应用程序的 Firebase 身份验证,您需要进行一些配置。此处已对所有内容进行了说明,因此请务必仔细阅读本指南。

我还写了一篇关于Ionic Apps 中的 Firebase 身份验证的教程,并提到了如何解决这个问题以及如何为 Google Sign In with Firebase 配置所有内容。


推荐阅读