Oauth 登录后Facebook未在主页上重定向(Facebook身份验证)?
我有以下代码:Oauth 登录后Facebook未在主页上重定向(Facebook身份验证)?,oauth,facebook,oauth-2.0,Oauth,Facebook,Oauth 2.0,我有以下代码: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en-US" xml:lang="en-US"> <head> <title>Login Page</title> </head> <body> <div id="fb-root"></div> <script type="text/j
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en-US" xml:lang="en-US">
<head>
<title>Login Page</title>
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
FB.init({
appId:'MY_APP_ID', cookie:true,
status:true, xfbml:true
});
</script>
<div id="login-box">
<fb:login-button perms="email,offline_access" redirect_uri="http://mydomain.com:8000/home/">
Facebook
</fb:login-button>
</div>
</body>
</html>
登录页面
FB.init({
appId:'MY_APP_ID',cookie:true,
状态:true,xfbml:true
});
脸谱网
它要求用户允许特权,但在用户成功允许应用程序后,它不会重定向到重定向\u uri
页面,并保持在同一页面上
这是django应用程序的一部分。可以尝试添加
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId: 'appid',
cookie: true,
xfbml: true,
oauth: true
});
// whenever the user logs in, we refresh the page
FB.Event.subscribe('auth.login', function(response) {
window.location="your redirect";
});
};
</script>
window.fbAsyninit=函数(){
FB.init({
appId:'appId',
曲奇:是的,
xfbml:是的,
真的吗
});
//每当用户登录时,我们都会刷新页面
FB.Event.subscribe('auth.login',函数(响应){
window.location=“您的重定向”;
});
};
另一种选择是使用on login参数重定向:
<fb:login-button perms="email,offline_access" on-login="window.location = 'http://www.example.com';">Facebook</fb:login-button>
Facebook
您是否尝试过url编码重定向\u uri
?(http%3A%2F%2Fmydomain.com%3A8000%2Fhome%2F
)在您的情况下,如何获取访问代码。在你的情况下,Facebook不会传递访问码。你将如何获得访问码,因为在你的情况下,Facebook不会返回任何访问码!