【问题标题】:firebase authentication with facebook使用 Facebook 进行 Firebase 身份验证
【发布时间】:2017-11-03 02:14:54
【问题描述】:

在这里提问之前我已经尽力了。

我正在尝试通过关注此帖子link 来使用 ngcordova auth 实现 facebook 身份验证

我在 ionic 1 中使用 Firebase Firebase v3.6.4 和 angularfire。

$cordovaOauth.facebook("222222222222", ["email"])
              .then(function (result) {
                var credentials = firebase.auth.FacebookAuthProvider.credential(result.access_token);
                ToastFac.showMsgToUser("Authentication failed:"+result.access_token);
                return firebase.auth().signInWithCredential(credentials);
              })
              .then(function (firebaseUser) {
                  ToastFac.showMsgToUser("Signed in as:"+ firebaseUser.uid);
                console.log("Signed in as:", firebaseUser.uid);
              })
              .catch(function (error) {
                  ToastFac.showMsgToUser("Authentication failed:"+ error);
                console.error("Authentication failed:", error);
              });

在尝试使用上述代码时,我得到了 facebook 登录屏幕和访问令牌,但在设备和模拟器中运行时出现以下错误。

我已经从配置 xml 和 SHA1 证书中添加了包名称,方法是从

keytool -exportcert -list -v -alias androiddebugkey -keystore "PATH\.android\debug.keystore"

我不确定我还缺少什么。能不能在这里给个建议。

【问题讨论】:

  • 您是否对浏览器 API 密钥设置了任何限制?如果是这样,您需要转到云控制台并删除它们。
  • 没什么。
  • 嗯,这是您在浏览器 API 密钥上设置“密钥限制”时的典型错误。
  • 这一切都发生在 Cordova 的 inappbrowser 中

标签: angularjs firebase ionic-framework firebase-authentication angularfire


【解决方案1】:

经过一番搜索,终于找到了。 我们必须使用来自 Google 控制台的 API 密钥,而不是使用 firebase 提供的密钥。我没有从 Google 或 firebase 那里得到任何官方建议。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-09
    • 2017-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多