boolean useCookies = true; // use ${HOME}/.appcfg_oauth2_tokens_java
String oauth2ClientId = null;
String oauth2ClientSecret = null;
String oauth2RefreshToken = null;
OAuth2Native client = new OAuth2Native(useCookies, oauth2ClientId,
oauth2ClientSecret, oauth2RefreshToken);
Credential credential = client.authorize();
if (credential == null || credential.getAccessToken() == null) {
String errMsg = "Tokens expired? " + runOauth2Msg;
throw new ConfigurationException(errMsg);
}