title: OAuth 2.0 access token has expired, and a refresh token is not available
body: <p>I have a web based application which use Google OAuth2.0 as the login framework. It works nicely previously until yesterday. The applcation couldn't get the refresh token after the access token expired. Besides that, the "Request for permission" page had change to "Have offline access" instead of "Know who you are on Google" and "View you email"</p>
  
  <p>Originally, the "Request for permission" page will request the access to "Know who you are on Google" and "View you email". After user logout and attempts second login, the "Request for permission" page will be the same too.</p>
  
  <p>However, until yesterday, the "Request for permission" page changed to "Have offline access". After the access token is expired, I got the error messsage below:</p>
  
  <p>PHP Fatal error:  Uncaught exception 'Google_AuthException' with message 'The OAuth 2.0 access token has expired, and a refresh token is not available. Refresh tokens are not returned for responses that were auto-approved.' in /home2/xxxx/public_html/test/google-api-php-client/src/auth/Google_OAuth2.php:221</p>
  
  <p>I tried <code>$client-&gt;setAccessType('online');</code> . However, I still got this fatal error with me. Below is my code to get the access token :</p>
  
  <pre><code>    if ($client-&gt;getAccessToken()) {
        $token = $client-&gt;getAccessToken();
        $authObj = json_decode($token);
        $refreshToken = $authObj-&gt;refresh_token;
        $user = $oauth2-&gt;userinfo-&gt;get();
        $me = $plus-&gt;people-&gt;get('me');
        $email = filter_var($user['email'], FILTER_SANITIZE_EMAIL); // get the USER EMAIL ADDRESS using OAuth2
  
        $optParams = array('maxResults' =&gt; 100);
        $activities = $plus-&gt;activities-&gt;listActivities('me', 'public', $optParams);
  
  
        $_SESSION['access_token'] = $client-&gt;getAccessToken();
      } else {
        $authUrl = $client-&gt;createAuthUrl();
      }
  </code></pre>
  
  <p>I tried to search for similar problem like me but I couldn't find one. This happened since yesterday. Before this, I never made any change on the codes. </p>