title: An active access token must be used to query information about the current user in laravel
body: <p>I am trying to login with facebook using angularjs with laravel. But I am stuck with this error:</p>
  
  <blockquote>
    <p>{"error":{"message":"An active access token must be used to query
    information about the current user.","type":"OAuthExce (truncated...)</p>
  </blockquote>
  
  <p>Here is my Controller:</p>
  
  <pre><code> public function facebookLogin(Request $request){
          $client = new GuzzleHttp\Client();
  
          $params = [
              'code' =&gt; $request-&gt;input('code'),
              'client_id' =&gt; $request-&gt;input('clientId'),
              'redirect_uri' =&gt; $request-&gt;input('redirectUri'),
              'client_secret' =&gt; Config::get('app.facebook_secret'),
              'grant_type'=&gt;'client_credentials'
          ];
  
          // Step 1. Exchange authorization code for access token.
          $accessTokenResponse = $client-&gt;request('GET', 'https://graph.facebook.com/v2.5/oauth/access_token', [
              'query' =&gt; $params
          ]);
  
  
          $accessToken = json_decode($accessTokenResponse-&gt;getBody(), true);
  
          // Step 2. Retrieve profile information about the current user.
          $fields = 'id,email,first_name,last_name,link,name,picture';
          /**** problem counted with this request ************/
          $profileResponse = $client-&gt;request('GET', 'https://graph.facebook.com/v2.5/me', [
              'query' =&gt; [
                  'access_token' =&gt; $accessToken['access_token'],
                  'fields' =&gt; $fields
              ]
          ]);
  
          $profile = json_decode($profileResponse-&gt;getBody(), true);
  
          $user = User::where('email', '=', $profile['email'])-&gt;first();
  
          if($user) {
              Auth::loginUsingId($user-&gt;id);
              $user_info = Auth::user();
              $profile_seen = $user_info-&gt;profile_seen;
              User::where('id', '=', $user_info-&gt;id)-&gt;update(array('profile_seen' =&gt; 1));
              return Response::json(['login' =&gt; Auth::check(),'profile_seen' =&gt; $profile_seen ]);
  
          }else{
  
              $user = User::create(array(
                                          'username'   =&gt; $profile['name'], 
                                          'email'      =&gt; $profile['email'],
                                          'first_name' =&gt; $profile['first_name'],
                                          'last_name'  =&gt; $profile['last_name'],
                                          'facebook_id'=&gt; $profile['id']
                                         ));
  
              Auth::loginUsingId($user-&gt;id,1);
              $user_info = Auth::user();
              $profile_seen = $user_info-&gt;profile_seen;
              User::where('id', '=', $user_info-&gt;id)-&gt;update(array('profile_seen' =&gt; 1));
              return Response::json(['login' =&gt; Auth::check(),'profile_seen' =&gt; $profile_seen ]);
          }
  
      }
  </code></pre>