[英]Login using Facebook and Firebase on a Web Application
I'd like to use Facebook login through Firebase like this: 我想像这样通过Firebase使用Facebook登录:
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Facebook Access Token. You can use it to access the Facebook API.
}).catch(function(error) {
// Handle Errors here.
});
But I have still some trouble with an "authorization". 但是我对“授权”仍然有些麻烦。 Here my console error:
这是我的控制台错误:
I tried to check "Auth section -> Sign in" in Firebase, here's the picture: 我尝试在Firebase中检查“身份验证部分->登录”,如下图:
But that, unfortunately, did not help me. 不幸的是,那并没有帮助我。 So I checked the Google API console, here's the key:
所以我检查了Google API控制台,这是关键:
The Javascript error appears when I call signInWithPopup
function. 当我调用
signInWithPopup
函数时,出现Javascript错误。
Can somebody help me? 有人可以帮我吗? Thanks.
谢谢。
Assuming that you've already registered your application with Facebook, you need to add your Facebook application id and secret in Firebase and then register the OAuth redirect with Facebook. 假设您已经在Facebook中注册了应用程序,则需要在Firebase中添加Facebook应用程序ID和密码,然后在Facebook中注册OAuth重定向。
Of course @bojeil, this is the response of "getProjectConfig" request. 当然,@ bojeil,这是“ getProjectConfig”请求的响应。
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "The referrer https://mywebsite-28961.firebaseapp.com/__/auth/iframe?apiKey=AIzaSXXXXXXXXXXXJxJtYyQc&appName=%5BDEFAULT%5D&v=3.2.1&usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.fr.rHHEwUgDOpI.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCM__323woIJL0YGmPpXSAOboj0rkQ does not match the referrer restrictions configured on your API key. Please use the API Console to update your key restrictions.",
"extendedHelp": "https://console.developers.google.com/apis/credentials?project=952309991745"
}
],
"code": 403,
"message": "The referrer https://mywebsite-28961.firebaseapp.com/__/auth/iframe?apiKey=AIzaSXXXXXXXXXXXJxJtYyQc&appName=%5BDEFAULT%5D&v=3.2.1&usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.fr.rHHEwUgDOpI.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCM__323woIJL0YGmPpXSAOboj0rkQ does not match the referrer restrictions configured on your API key. Please use the API Console to update your key restrictions."
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.