【问题标题】:Getting redirect-cancelled-by-user error when using firebase SDK for authentication使用 firebase SDK 进行身份验证时出现重定向取消用户错误
【发布时间】:2018-02-24 12:12:36
【问题描述】:

我遵循了 firebase 文档中的说明:Authenticate Using OAuth Providers with Cordova,当尝试从 android 设备进行身份验证时,使用 firebase SDK 进行身份验证,我收到以下错误:redirect-cancelled-by-user。 尝试从 Web 进行身份验证,有效!

代码示例:

firebase.auth().signInWithRedirect(provider).then(function() {
  return firebase.auth().getRedirectResult();
}).then(function(result) {
  // This gives you a Google Access Token.
  // You can use it to access the Google API.
  var token = result.credential.accessToken;
  // The signed-in user info.
  var user = result.user;
  // ...
}).catch(function(error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
});

我看到了几个替代解决方案,但我对使用 firebase SDK 很感兴趣,所以有人可以解释一下,我哪里出错了吗?

【问题讨论】:

标签: android cordova firebase firebase-authentication ionic3


【解决方案1】:

在我的情况下,问题是 Firebase 说明告诉您安装 cordova-universal-links-plugin-fix,但它没有更新 Cordova 8.0 上的 AndroidManifest.xml 文件。安装了插件cordova-universal-links-plugin-fixed,效果很好!所以:

# Plugin to handle Universal Links (Android app link redirects)
cordova plugin add cordova-universal-links-plugin-fixed --save

【讨论】:

    猜你喜欢
    • 2020-12-24
    • 1970-01-01
    • 1970-01-01
    • 2021-12-12
    • 2012-07-06
    • 1970-01-01
    • 2021-05-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多