I am trying to get an access token to use the Google Play Android Developer API, and I got this far using the Google API Java Client documentation example:
HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
JsonFactory JSON_FACTORY = new JacksonFactory();
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(HTTP_TRANSPORT)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId("...gserviceaccount.com")
.setServiceAccountScopes("https://www.googleapis.com/auth/androidpublisher")
.setServiceAccountPrivateKeyFromP12File(keyFile)
.build();
But how do I get the access token from this credential? credential.getAccessToken()
returns null
. Am I doing something wrong, or missing some steps?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…