I have a strange problem. I am writing an application in the Java kernel that needs to access its account in google docs. Therefore, after a lot of searches, I found that OAuth2.0 with a service account is what I am looking for. But I do not use App Engine or anything else. This is a simple application. I do not know how to use OAuth. I wrote the code below, and I do not know how to move on. Looking for someone to guide me further:
GoogleCredential credential = new GoogleCredential.Builder().setTransport(HTTP_TRANSPORT).setJsonFactory(JSON_FACTORY)
.setServiceAccountId(EMAIL)
.setServiceAccountScopes(SCOPE)
.setServiceAccountPrivateKeyFromP12File(new File("lib/key.p12")).build();
SpreadsheetService service = new SpreadsheetService("My test Service");
Thanks you!
source
share