I have the following code:
<!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
});
<开发者_StackOverflow中文版;/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>
It asks the user to allow the privileges, but it doesn't redirect to the redirect_uri
page after successfully allowing the application by the user and remains on the same page.
This is part of a django application.
One alternative is to use the on-login parameter to redirect:
<fb:login-button perms="email,offline_access" on-login="window.location = 'http://www.example.com';">Facebook</fb:login-button>
maybe try adding
<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>
精彩评论