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

后端 未结 25 860
南方客
南方客 2020-12-01 01:37

i\'m trying to get Facebook user id using the php sdk like this

$fb = new Facebook\\Facebook([
    \'app_id\' => \'11111111111\',
    \'app_secret\' =>         


        
25条回答
  •  有刺的猬
    2020-12-01 02:35

    For me the problem was different; (I was stupid) I had a popup window with Facebook login and again Facebook login buttons in Login/Signup page.

    • Whenever i click the Facebook button in the popup from other pages it worked fine.
    • But, when i click the Facebook button in the popup from Login/Signup page, it would not work.

    The reason was i had re-instantiated the Facebook and getRedirectLoginHelper objects. I had to comment out these statements in Login/Signup pages, as it was already available.

    $_SESSION['FBRLH_state']=$_GET['state'];
    

    is not the way to go. Although it worked.

提交回复
热议问题