2

URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs. The above error shown in while i press login with facebook

in valid outh http://www.example.com/the78/login-facebook.php

and all the process in my side is handle on the same url.

<?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
eightShirt
  • 1,457
  • 2
  • 15
  • 29
Sumit Aggarwal
  • 831
  • 2
  • 16
  • 29

0 Answers0