Facebook : Fatal error: Uncaught exception 'Facebook\Exceptions\FacebookSDKException' with message 'Signed request has an invalid signature.'
<p>I just copied the following script from facebook 
<a href="https://developers.facebook.com/docs/php/gettingstarted" rel="nofollow noreferrer">https://developers.facebook.com/docs/php/gettingstarted</a></p>

<p>I downloaded the main code using composer</p>

<pre><code> &lt;?php
    session_start();
    require_once '../../Facebook/autoload.php';
    print_r($_SESSION);
    //if(!isset($_SESSION['user']) || ($_SESSION['user'] &lt; 1) || ($_SESSION['user'] == '')){
        $fb = new Facebook\Facebook([
      'app_id' =&gt; '1444966872674589',
      'app_secret' =&gt; '54362fa0c423jdui348758ea172537fb',
      'default_graph_version' =&gt; 'v2.5',
      ]);   

      $helper = $fb-&gt;getCanvasHelper();
      try {
        $accessToken = $helper-&gt;getAccessToken();
      } catch(Facebook\Exceptions\FacebookResponseException $e) {
        // When Graph returns an error
        echo 'Graph returned an error: ' . $e-&gt;getMessage();
        exit;
      } catch(Facebook\Exceptions\FacebookSDKException $e) {
        // When validation fails or other local issues
        echo 'Facebook SDK returned an error: ' . $e-&gt;getMessage();
        exit;
      }

      if (isset($accessToken)) {
        try {
          $response = $fb-&gt;get('/me');
          $userNode = $response-&gt;getGraphUser();
        } catch(Facebook\Exceptions\FacebookResponseException $e) {
          // When Graph returns an error
          echo 'Graph returned an error: ' . $e-&gt;getMessage();
          exit;
        } catch(Facebook\Exceptions\FacebookSDKException $e) {
          // When validation fails or other local issues
          echo 'Facebook SDK returned an error: ' . $e-&gt;getMessage();
          exit;
        }

        echo 'Logged in as ' . $userNode-&gt;getName();
        print_r($userNode-&gt;getName());
      } 


    //}
</code></pre>

<p>But above code throws error </p>

<blockquote>
<pre><code>  Fatal error: Uncaught exception 'Facebook\Exceptions\FacebookSDKException' with message 'Signed request has an invalid signature.'
</code></pre>
</blockquote>

<p>I have already read this links<br>
<a href="https://stackoverflow.com/questions/23566644/integrating-facebook-in-php-giving-invalid-signed-request-with-oauth-data">Integrating facebook in php giving invalid signed request with oAuth data</a></p>

<p>and </p>

<p><a href="https://stackoverflow.com/questions/19477458/integrating-facebook-php-sdk-in-facebook-canvas-app-giving-blank-page-or-oauthda/23685616#23685616">Integrating facebook php sdk in Facebook Canvas App giving Blank page or oauthData error</a></p>

<p>But it didn't solve my problem</p>

<p>please help I can't solve the problem</p>