I am in a strange problem. I am writing an application in core java which needs to access its own account at google docs. So after doing a lot of googling, I found that OAuth2.0 with Service Account is something I am looking for. But I am not using App Engine or anything. Its a simple application. I don't know how can I use the OAuth. I have written below code and I dont know how to proceed further. 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");
//service .setOAuthCredentials(parameters, signer);
Thanks you !