title: Laravel 4 - Google Sign In
body: <p>I am new in Laravel</p>
  
  <p>I am testing Google Sign In with oauth-4-laravel by following the guide. I am managed to select my google account but after that it returned the URL like:</p>
  
  <p><a href="http://host.com/google/loginwithgoogle?code=4/SXVJ-Ou9xLt60kZ-OR68DxxxxxXFD.kqJwUtyEmhcfXE-sT2ZxxxxxxxxxxxxigI" rel="nofollow">http://host.com/google/loginwithgoogle?code=4/SXVJ-Ou9xLt60kZ-OR68DxxxxxXFD.kqJwUtyEmhcfXE-sT2ZxxxxxxxxxxxxigI</a></p>
  
  <p>How can I handle this route within my Route.php file? My current code on Route.php is:</p>
  
  <pre><code>Route::get('login', function()
  {
  return View::make('login');
  });
  
  Route::controller('google', 'GoogleController');
  </code></pre>
  
  <p>And my GoogleController.php code</p>
  
  <pre><code>public function postLoginwithgoogle(){
  
      // get data from input
      $code = Input::get( 'code' );
  
      // get google service
      $googleService = OAuth::consumer( 'Google' );
  
      // check if code is valid
  
      // if code is provided get user data and sign in
      if ( !empty( $code ) ) {
  
          // This was a callback request from google, get the token
          $token = $googleService-&gt;requestAccessToken( $code );
  
          // Send a request with it
          $result = json_decode( $googleService-&gt;request( 'https://www.googleapis.com/oauth2/v1/userinfo' ), true );
  
          $message = 'Your unique Google user id is: ' . $result['id'] . ' and your name is ' . $result['name'];
          echo $message. "&lt;br/&gt;";
  
          //Var_dump
          //display whole array().
          dd($result);
  
      }
      // if not ask for permission first
      else {
          // get googleService authorization
          $url = $googleService-&gt;getAuthorizationUri();
  
          // return to facebook login url
          return Redirect::to( (string)$url );
      }
  }
  </code></pre>
  
  <p>I suspect is the 'post' and 'get' but how should I code it? Thanks!</p>