我的源代码中包含以下内容。我收到警报“无响应”,然后Facebook页面说 “MYAPP发生错误。请稍后再试”
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js" charset="utf-8"></script>
<script>
FB.init({appId: 'MYAPPID',status: true, cookie:true, xfbml: true});
</script>
<script>
FB.getLoginStatus(function(response){
if(!response.session){
alert("NO RESPONSE");
top.location.href="http://www.facebook.com/dialog/oauth?client_id=MYAPPID&redirect_uri=http://MYWEBSITE";
}
});
无法看到我/哪里出错。
由于
我现在收到以下错误:
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.
答案 0 :(得分:0)
您使用的是较旧的登录代码。对于FB.init,您应该设置oauth: true
,并且您需要检查response.authResponse而不是response.session。
<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({ appId: 'MYAPPID', status: true, cookie: true, xfbml: true, oauth: true });
FB.getLoginStatus(function(response){
if(!response.authResponse){
alert("NO RESPONSE");
top.location.href="http://www.facebook.com/dialog/oauth?client_id=MYAPPID&redirect_uri=http://MYWEBSITE";
}
});
</script>
</body>
</html>