title: Get refresh token google api
body: <p>I can't get my refresh token with my code. I can only get my access token, token type etc.,
  I have followed some tutorials like putting <code>access_type=offline</code> on my login URL:</p>
  
  <pre><code>echo "&lt;a href='https://accounts.google.com/o/oauth2/auth?" 
      . "access_type=offline&amp;client_id=123345555.apps.googleusercontent.com&amp; "
      . "scope=https://www.googleapis.com/auth/calendar+https://www.googleapis.com/auth/plus.me&amp;response_type=code&amp; "
      . "redirect_uri=http://www.sample.com/sample.php&amp;state=/profile'&gt;Google&lt;/a&gt;";
  </code></pre>
  
  <p>and my fields in getting the access token:</p>
  
  <pre><code>$fields=array(
      'code'=&gt;  urlencode($authcode),
      'client_id'=&gt; urlencode($clientid),
      'client_secret'=&gt; urlencode($clientsecret),
      'redirect_uri'=&gt; urlencode($redirecturi),
      'grant_type'=&gt; 'authorization_code',
  );
  </code></pre>
  
  <p>but I can't get <em>refresh_token</em>, just the <em>access_token</em>, <em>token_type</em>, <em>id_token</em> and <em>expires_in</em>.</p>