我几乎从Hello.js网站复制/粘贴了这个示例:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="js/vendor/hello/hello.js"></script>
</head>
<body>
<script>
hello.init({
facebook : XXXXXXXXXXX, //Plz note that I replaced a correct ID with the XXXXXXXXXX
},{redirect_uri:'redirect.html'});
hello.on('auth.login', function(auth){
// call user information, for the given network
hello( auth.network ).api( '/me' ).then( function(r){
// Inject it into the container
var label = document.getElementById( "profile_"+ auth.network );
if(!label){
label = document.createElement('div');
label.id = "profile_"+auth.network;
document.getElementById('profile').appendChild(label);
}
label.innerHTML = '<img src="'+ r.thumbnail +'" /> Hey '+r.name;
});
});
</script>
<button onclick="hello('facebook').login()">Facebook</button>
</body>
</html>但是,当我单击facebook登录按钮时,控制台总是向我显示这个错误:
未定义的TypeError:无法读取未定义的属性“response_type”
我是不是遗漏了什么?
提前谢谢。
发布于 2014-11-18 04:46:36
首先必须注册为Facebook开发者才能获得Facebook,然后可以用ID替换facebook : XXXXXXXXXXX,还必须指定返回的URL。例如:
hello.init({
facebook : 355555184404909, //eg. Facebook ID
},{redirect_uri:'http://yourDomain/return.html'});您还可以在这些网络( Windows Live或Google+ )上注册为开发人员。
编辑:添加了如何在Facebook网站平台上注册您的域名
您必须在上注册您的域,以允许库重定向到您的域

只需在“网站网址”字段输入您的域http://yourDomain即可。
发布于 2014-11-18 04:49:58
你需要以Facebook开发者(https://developers.facebook.com/apps)的身份创建一个应用程序。然后,您可以检索Facebook应用程序的客户端ID。
如hello的官方网站所示:
hello.init({
facebook : FACEBOOK_CLIENT_ID,
},{redirect_uri:'redirect.html'});https://stackoverflow.com/questions/26986653
复制相似问题