This is how I create my GoogleAuthorizationCodeFlow
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("credentials.oauth-credentials").getFile());
return new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY,
clientId, clientSecret, SCOPES)
.setDataStoreFactory(new FileDataStoreFactory(file))
.setAccessType("offline")
.build();
then after authorizing the user in Google and redirect back to my site, I save the credentials to the credential store by doing this
flow.createAndStoreCredential(tokenResponse, userId);
Then I open my credentials.oauth-credentials file (located in my classpath). I expect it to contain the credentials that I just saved, but this file is empty. May I know why?
Also, I tried shutting down my app after I saved a credential then starting up my app again. Now the credential store says that the credentials saved earlier does not exist. It's like when my app is restarted, the credential store resets itself. Why is this happening?