网址已阻止:此重定向失败,因为重定向URI不是 已在应用的客户端OAuth设置中列入白名单。确保客户端和 已启用Web OAuth登录,并将所有应用程序域添加为有效OAuth 重定向URI。我按下登录时显示上述错误 实
在有效的outh http://www.example.com/the78/login-facebook.php
中我身边的所有过程都是在同一个网址上处理。
<?php
require 'facebook/facebook.php';
require 'fbconfig.php';
require 'functions.php';
$facebook = new Facebook(array(
'appId' => APP_ID,
'secret' => APP_SECRET,
));
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
if (!empty($user_profile )) {
die('we are in ');
# User info ok? Let's print it (Here we will be adding the login and registering routines)
$username = $user_profile['name'];
$uid = $user_profile['id'];
$email = $user_profile['email'];
$user = new User();
$userdata = $user->checkUser($uid, 'facebook', $username,$email,$twitter_otoken,$twitter_otoken_secret);
if(!empty($userdata)){
session_start();
$_SESSION['id'] = $userdata['id'];
$_SESSION['oauth_id'] = $uid;
$_SESSION['username'] = $userdata['username'];
$_SESSION['email'] = $email;
$_SESSION['oauth_provider'] = $userdata['oauth_provider'];
echo ("<script>location.href='users/home.php'</script>");
}
} else {
# For testing purposes, if there was an error, let's kill the script
die("There was an error.");
}
} else {
# There's no active session, let's generate one
$login_url = $facebook->getLoginUrl(array( 'scope' => 'email'));
// header("Location: " . $login_url);
echo ("<script>location.href='$login_url'</script>");
}
?>
This is the facebook url which shows error
https://www.facebook.com/dialog/oauth?client_id=1575902869377664&redirect_uri=http%3A%2F%2Fexample.com%2Fthe78%2Flogin-facebook.php&state=f80b87f59baa9ca6ec69733e55b227f0&scope=email