Facebook SDK返回错误:跨站点请求伪造验证失败[错误]

时间:2017-04-11 14:30:56

标签: php facebook facebook-graph-api facebook-sdk-4.0

我登录时收到此错误:

Facebook SDK returned an error: Cross-site request forgery validation failed. The "state" param from the URL and session do not match.

login.php有以下代码:

   <?php
    session_start();

    include 'config.php';
   /import sdk login.php
    require PATH.FOLDER.'facebook-php-sdk-master\\src\\Facebook\\autoload.php';

    //do login operation
 $fb = new Facebook\Facebook([
      'app_id' => APPID,
      'app_secret' => APPSECRET,
      'default_graph_version' => 'v2.8',
      ]);

    $helper = $fb->getRedirectLoginHelper();

    $permissions = ['email', 'public_profile']; // Optional permissions
    $loginUrl = $helper->getLoginUrl(INDIRIZZORITORNO, $permissions);    
    //echo '<a href="' . $loginUrl . '">Log in with Facebook!</a>';  

    header("Location: ".$loginUrl);

    ?>

任何人都可以帮助我?

0 个答案:

没有答案