我试图得到一个访问令牌使用谷歌Play Android开发者API,我能走到今天使用the Google API Java Client documentation example:如何从GoogleCredential获取访问令牌?
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();
但我怎么得到这个证书的访问令牌? credential.getAccessToken()
返回null
。我做错了什么,或者错过了一些步骤?
此外,请检查http://stackoverflow.com/a/24264696/165708一些更多的步骤,你可能需要采取一切工作。 –