1

I am trying to access google sheets using Java client Library. First time access token and refresh token are generated and stored in File.(StoredCredential). Once the access token expires new token is not generated with Refresh token. Please suggest what can be done.

Sample Code:

 GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
                HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
                .setDataStoreFactory(new FileDataStoreFactory(new java.io.File(TOKENS_DIRECTORY_PATH)))
                .setAccessType("offline")
                 .build();
        LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build();
        return new AuthorizationCodeInstalledApp(flow, receiver).authorize("user");
Arek Bal
  • 712
  • 8
  • 13

0 Answers0