title: google api & OAuth2 get refresh token
body: <p>I have the following code:</p>
  
  <pre><code>$this-&gt;client = new Google_Client();
  $this-&gt;client-&gt;setAuthConfig(FCPATH . 'google-api-php-client-master'.DIRECTORY_SEPARATOR.'client_secret.json');
  $this-&gt;client-&gt;setRedirectUri($redirect_uri);
  $this-&gt;client-&gt;addScope("https://www.googleapis.com/auth/calendar");
  $this-&gt;client-&gt;setAccessType('offline');
  $this-&gt;client-&gt;setApprovalPrompt("force");
  $this-&gt;client-&gt;setAccessToken($access_token);
  if ($this-&gt;client-&gt;isAccessTokenExpired()) {
      $this-&gt;client-&gt;refreshToken($this-&gt;client-&gt;getRefreshToken());
      print_r($this-&gt;client-&gt;getAccessToken());
  }
  </code></pre>
  
  <p>When I print_r get access token, I got the following array without refresh token:</p>
  
  <pre><code>Array
  (
      [access_token] =&gt; ya29.LwIjjaXB1kGunCp8EzwMwmaO4eoDsqbdoRFNjWhcDvw59RtDnT6mbjlauX3PM6irbMfg
      [token_type] =&gt; Bearer
      [expires_in] =&gt; 3600
      [created] =&gt; 1447747649
  )
  </code></pre>
  
  <p>But I want to get such an array with refresh token, for example:</p>
  
  <pre><code>Array
  (
      [access_token] =&gt; ya29.LwIjjaXB1kGunCp8EzwMwmaO4eoDsqbdoRFNjWhcDvw59RtDnT6mbjlauX3PM6irbMfg
      [token_type] =&gt; Bearer
      [expires_in] =&gt; 3600
      [refresh_token] =&gt; 1/wzTZcDm2fzZD9y3Ixr2gczgC5iD1zifVSGQoijCu4vlIgOrJDtdun6zK6XiATCKT
      [created] =&gt; 1447747649
  )
  </code></pre>