gpt4 book ai didi

javascript - 显示错误的 Hello.js 示例

转载 作者:行者123 更新时间:2023-11-30 05:31:05 25 4
gpt4 key购买 nike

我几乎是从 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 登录按钮时,控制台总是显示这个错误:

Uncaught TypeError: Cannot read property 'response_type' of undefined

我错过了什么吗?

提前致谢。

最佳答案

您必须先注册为 Facebook Developer获取 Facebook Developer ID,然后您可以将 facebook : XXXXXXXXXXX 替换为您的 ID。您还必须指定返回 URL。例如。

hello.init({ 
facebook : 355555184404909, //eg. Facebook ID
},{redirect_uri:'http://yourDomain/return.html'});

您还可以在这些网络上将自己注册为开发人员 Windows LiveGoogle+

编辑:添加了如何将您的域注册到 Facebook 网站平台

您必须在 Facebook 开发者设置中注册您的域,以允许库重定向到您的域 Website platform configuration只需在“网站 URL”字段中输入您的域 http://yourDomain

关于javascript - 显示错误的 Hello.js 示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26986653/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com