title: OAuth2 callback: redirect after getting an access token by authenticating a code
body: <p>Taking a look at this <a href="https://github.com/google/google-api-php-client/blob/a88dcec6833ac2de4798c13a24abe30c90feb057/examples/idtoken.php" rel="nofollow">google client api for php example</a></p>
  
  <p>I noticed this part of the code:</p>
  
  <pre><code>/************************************************
    If we have a code back from the OAuth 2.0 flow,
    we need to exchange that with the authenticate()
    function. We store the resultant access token
    bundle in the session, and redirect to ourself.
   ************************************************/
  if (isset($_GET['code'])) {
    $client-&gt;authenticate($_GET['code']);
    $_SESSION['access_token'] = $client-&gt;getAccessToken();
    $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
    header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
  }
  </code></pre>
  
  <p>The thing is I don't get the redirect (<code>header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));</code>). In fact you can remove it and everything seems to go on just fine. So, why is it there?</p>