Created
April 27, 2016 00:31
-
-
Save julioz/9ad47052cf2f9ec1cdbd99747dc82872 to your computer and use it in GitHub Desktop.
GoogleCredential instantiation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NetHttpTransport http = GoogleNetHttpTransport.newTrustedTransport(); | |
JacksonFactory json = JacksonFactory.getDefaultInstance(); | |
Set<String> scopes = Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER); | |
File secretFile = new File(Constants.SECRET_FILE_PATH); | |
GoogleCredential credential = new GoogleCredential.Builder(). | |
setTransport(http). | |
setJsonFactory(json). | |
setServiceAccountPrivateKeyId(Constants.KEY_ID). | |
setServiceAccountId(Constants.SERVICE_ACCOUNT_EMAIL). | |
setServiceAccountScopes(scopes). | |
setServiceAccountPrivateKeyFromPemFile(secretFile). | |
build(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment