【发布时间】:2011-10-14 04:03:06
【问题描述】:
我在 Facebook 上的应用程序使用 JavaScript SDK。当用户导航到我的应用程序页面并转到我的应用程序时,弹出窗口要求他们授权该应用程序。这很好用。
但是,如果他们授权该应用程序,然后稍后再返回,另一个弹出窗口(我相信这是另一个授权窗口)将快速打开然后关闭。
我的代码在做什么?代码如下。
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '221953271200525', // App ID
channelURL : '//www.vidjahgames.com/fall/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true, // enable OAuth 2.0
xfbml : true // parse XFBML
});
// Additional initialization code here
FB.login(function(response) {
if (response.authResponse) {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Good to see you, ' + response.name + '.');
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {scope: 'email'});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
【问题讨论】:
标签: javascript facebook authorization