title: Refresh Token with Google API Java Client Library
body: <p>I'm using the Google API Java Client <a href="http://code.google.com/p/google-api-java-client/" rel="nofollow">http://code.google.com/p/google-api-java-client/</a> and am able to get the access token successfully for Android.</p>
  
  <pre><code>    // Google Accounts
  credential = GoogleAccountCredential.usingOAuth2(this, CalendarScopes.CALENDAR);
  SharedPreferences settings = getPreferences(Context.MODE_PRIVATE);
  credential.setSelectedAccountName(settings.getString(PREF_ACCOUNT_NAME, null));
  </code></pre>
  
  <p>As I'd like my web server to make offline API calls, I need a refresh token. I have been searching extensively and have not yet figured out how to do so.</p>
  
  <p>Ideally, I'd prefer to use the Google API Java Client over the WebView to grab the refresh token (no need to enter a username or password). </p>
  
  <p>Any help would be appreciated!</p>