title: Is setAccessToken necessary after refreshToken? - Google API PHP
body: <p>Here is my code:</p>
  
  <pre><code>$client = new Google_Client();
  $client-&gt;setApplicationName("dayPlanner");
  $client-&gt;setClientId(env('googleClientID'));
  $client-&gt;setClientSecret(env('googleClientSecret'));
  $client-&gt;setAccessToken(session('token'));
  
  if($client-&gt;isAccessTokenExpired()) {
      $client-&gt;refreshToken($user-&gt;refreshToken);
      $token = $client-&gt;getAccessToken();
      session(['token' =&gt; $token]);
      $client-&gt;setAccessToken($token); // necessary..?
  }
  </code></pre>
  
  <p>This works, but I don't fully understand it. Most examples online show the refreshToken (and getAccessToken for the session data), but none I've seen then use setAccessToken again. Logic dictates this is necessary, and it works, but I'd like a definitive answer and to understand this a little better.</p>
  
  <p>(Note, Laravel syntax used for setting/retriving session data)</p>