Facebook Connect: Error when clicking the Facebook Connect button
Posted
by Garrett
on Stack Overflow
See other posts from Stack Overflow
or by Garrett
Published on 2010-06-14T03:11:17Z
Indexed on
2010/06/14
3:12 UTC
Read the original article
Hit count: 835
I am getting this error when I click on the facebook connect button:
API Error Code: 100
API Error Description: Invalid parameter
Error Message: next is not owned by the application.
I am not too sure how to do this, but I've read all the documentation for facebook connect and came up with this:
<?php
date_default_timezone_set("America/Toronto");
define('FACEBOOK_APP_ID', '##################');
define('FACEBOOK_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
function get_facebook_cookie($app_id, $application_secret) {
if(!isset($_COOKIE['fbs_' . $app_id])) return null;
$args = array();
parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args);
ksort($args);
$payload = '';
foreach ($args as $key => $value) {
if ($key != 'sig') {
$payload .= $key . '=' . $value;
}
}
if (md5($payload . $application_secret) != $args['sig']) {
return null;
}
return $args;
}
$cookie = get_facebook_cookie(FACEBOOK_APP_ID, FACEBOOK_SECRET);
?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<!-- JQUERY INCLUDE -->
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<!-- FACEBOOK CONNECT INCLUDE -->
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script>
<script type="text/javascript">
<!--
$(document).load(function() {
});
FB.init("XXXXXXXXXXXXXXXXXXXXXXx
", "xd_receiver.htm"); FB.Event.subscribe('auth.login', function(response) { window.location.reload(); });
function facebook_onlogin() {
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, someone you know
fb_login.hide();
} else {
// no user session available, someone you dont know
}
});
}
// -->
</script>
</head>
<body>
<div id="fb_login">
<fb:login-button onlogin="facebook_onlogin();" v="2">Log In with Facebook</fb:login-button>
</div>
<?php
$user = json_decode(file_get_contents(
'https://graph.facebook.com/me?access_token=' .
$cookie['access_token']))->id;
?>
</body>
</html>
how on earth can i get this to work?
thanks!
© Stack Overflow or respective owner