Код: Выделить всё
final InputStream in = DemoService.class.getResourceAsStream(this.googleConfiguration.getCredentialsPath());
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(this.jsonFactory, new InputStreamReader(in));
final GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
this.httpTransport,
this.jsonFactory,
clientSecrets,
SCOPES
).setDataStoreFactory(buildJpaFactory()).setAccessType("offline").build();
final LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build();
return new AuthorizationCodeInstalledApp(flow, receiver).authorize(email);
Код: Выделить всё
return new GoogleRefreshTokenRequest(
new NetHttpTransport(), this.jsonFactory, refreshToken, clientId, clientSecret
).setScopes(SCOPES).setGrantType("refresh_token").set("access_type", "offline").execute();
Подробнее здесь: https://stackoverflow.com/questions/792 ... to-refresh