1

My integration with Google tables worked successfully for half a year, but today it stopped because of an error java.io.StreamCorruptedException: invalid stream header: EFBFBDEF

has anyone encountered such an error?

 private static Credential authorize() throws IOException, GeneralSecurityException {
    InputStream in = SheetsHelper.class.getResourceAsStream("/credentials.json");
    GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JacksonFactory.getDefaultInstance(), new InputStreamReader(in));

    List<String> scopes = Arrays.asList(SheetsScopes.SPREADSHEETS);

    GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
            GoogleNetHttpTransport.newTrustedTransport(), JacksonFactory.getDefaultInstance(),
            clientSecrets, scopes
    ).setDataStoreFactory(new FileDataStoreFactory(new java.io.File("tokens"))).setAccessType("offline")//<--the error is here
            .build();

    Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
    return credential;
}
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
mr x
  • 11
  • 1
  • 1
    Please provide a stack trace - at the moment we have no idea where the exception is being thrown. – Jon Skeet Jan 24 '22 at 08:23
  • Can you check that the refresh token wasnt revoked. Just change "user" to something else as a test or delete the file in new java.io.File("tokens"). My guess is your getting an invalid_token error. – Linda Lawton - DaImTo Jan 24 '22 at 08:32

0 Answers0