在 Facebook 上使用 Firebase 身份验证

Bil*_*ope 5 facebook-authentication firebase firebase-authentication

在我的 android 手机上测试期间尝试登录我的网络应用程序时,我收到以下消息:

“firebase.js:75 未捕获错误:此应用程序运行的环境不支持此操作。“location.protocol”必须是 http 或 https..”

我将我的 firebase url 添加到我的 fb 应用程序上的有效 OAuth 重定向 URI - https://.firebaseio.com/ 我在 auth 部分将我的应用程序 ID 和名称添加到 firebase。我错过了什么吗?谢谢

我在这里使用 chrome 远程调试:file:///android_asset/www/index.html#/app/people

这可能是它大惊小怪的原因吗?

var provider = new firebase.auth.FacebookAuthProvider();

console.log(provider);
  firebase.auth().signInWithPopup(provider).then(function(result) {
 // This gives you a Facebook Access Token. You can use it to access theFacebook API.
   var token = result.credential.accessToken;
// The signed-in user info.
  var user = result.user;
  console.log(user, token);
  UserService.setUser(user, token);
// ...
}).catch(function(error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
  // The email of the user's account used.
  var email = error.email;
  // The firebase.auth.AuthCredential type that was used.
  var credential = error.credential;
  console.log(errorCode);

  });
Run Code Online (Sandbox Code Playgroud)

boj*_*eil 1

仅在 http/https 环境中支持以下操作:signInWithPopup、signInWithRedirect、linkWithPopup、linkWithRedirect 和 getRedirectResult。您可以使用文件环境中的其余 api。