use of com.google.appengine.api.appidentity.AppIdentityService.GetAccessTokenResult in project google-auth-library-java by google.
the class AppEngineCredentials method refreshAccessToken.
/**
* Refresh the access token by getting it from the App Identity service
*/
@Override
public AccessToken refreshAccessToken() throws IOException {
if (createScopedRequired()) {
throw new IOException("AppEngineCredentials requires createScoped call before use.");
}
GetAccessTokenResult accessTokenResponse = appIdentityService.getAccessToken(scopes);
String accessToken = accessTokenResponse.getAccessToken();
Date expirationTime = accessTokenResponse.getExpirationTime();
return new AccessToken(accessToken, expirationTime);
}
Aggregations