如何在top.location上创建facebook FB.login()对话框
我正在构建Facebook IFrame应用程序,我请求用户允许该应用程序的权限。当用户首次登录我的应用程序时,IFrame应用程序将弹出一个窗口,请求用户允许权限 我的问题是:我不希望这个权限窗口弹出,这个弹出窗口可以像top.location.href一样,就在我的应用程序页面的顶部 我的代码是如何在top.location上创建facebook FB.login()对话框,facebook,facebook-javascript-sdk,Facebook,Facebook Javascript Sdk,我正在构建Facebook IFrame应用程序,我请求用户允许该应用程序的权限。当用户首次登录我的应用程序时,IFrame应用程序将弹出一个窗口,请求用户允许权限 我的问题是:我不希望这个权限窗口弹出,这个弹出窗口可以像top.location.href一样,就在我的应用程序页面的顶部 我的代码是 window.fbAsyncInit = function() { FB.init({appId: '', sta
window.fbAsyncInit = function() {
FB.init({appId: '',
status: true,
cookie: true,
xfbml: true,
oauth : true //enables OAuth 2.0
});
FB.getLoginStatus(function(response) {
if (response.authResponse) {
} else {
FB.login();
}
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
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 + '.');
FB.logout(function(response) {
console.log('Logged out.');
});
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {scope: 'email'});
听起来您想将整个页面重定向到授权对话框,是吗 如果是这样,您只需将页面重定向到此页面:
https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email
…其中,您的_URL是您希望在权限屏幕后将他们带到的页面