title: Cross-site request forgery validation failed required param state missing from persistent data
body: <p>I am trying cross domain fb login using graph API. </p>
  
  <p><a href="https://i.stack.imgur.com/ENVVN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ENVVN.jpg" alt="enter image description here"></a></p>
  
  <p>I am getting error "Facebook SDK returned an error: Cross-site request forgery validation failed. Required param "state" missing from persistent data"</p>
  
  <p><strong>Step 1 Code:</strong></p>
  
  <pre><code>$fb = new \Facebook\Facebook([
                'app_id'                =&gt; $this-&gt;appId,
                'app_secret'            =&gt; $this-&gt;appSecret,
                'default_graph_version' =&gt; $this-&gt;apiVersion,
      ]);
  
      $permissions = [
                      'email',                        
                      'manage_pages', 
                      'business_management',
                      'ads_management'
                      ];
  
      $helper    = $fb-&gt;getRedirectLoginHelper();
      $loginUrl  = $helper-&gt;getLoginUrl($this-&gt;redirectUrl.'?back_to='.$customer_website_url, $permissions);
  </code></pre>
  
  <p><strong>Step 3 Code</strong></p>
  
  <pre><code>$fb = new \Facebook\Facebook([
    'app_id'                =&gt; $appId,
    'app_secret'            =&gt; $appSecret,
    'default_graph_version' =&gt; $graph_api_version,
  ]);
  
  $helper = $fb-&gt;getRedirectLoginHelper();
  $accessToken = $helper-&gt;getAccessToken();
  </code></pre>
  
  <p>Everything I have explained in Image so anyone what can be the problem and possible solution?</p>