-
Notifications
You must be signed in to change notification settings - Fork 741
Google Play Android Developer API return 401 #548
Description
From Jonhy.co...@gmail.com on June 20, 2012 00:58:05
Version of google-api-java-client (e.g. 1.5.0-beta)? Google Play Android Developer API v1-rev2-1.7.1-beta Java environment (e.g. Java 6, Android 2.3, App Engine)? Java 6 Describe the problem. Server return 401 Unauthorized: This developer account does not own the application. How would you expect it to be fixed? HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
JsonFactory JSON_FACTORY = new JacksonFactory();
GoogleCredential credential = new GoogleCredential.Builder().setTransport(HTTP_TRANSPORT)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId(GOOGLE_CLIENT_MAIL)
.setServiceAccountScopes(" https://www.googleapis.com/auth/androidpublisher" )
.setServiceAccountPrivateKeyFromP12File(new File(GOOGLE_KEY_FILE_PATH))
.build();
Androidpublisher publisher = new Androidpublisher.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).
setApplicationName(GOOGLE_PRODUCT_NAME).
build();
Androidpublisher.Purchases purchases = publisher.purchases();
Get get = purchases.get("XXXXX", subscriptionId, token);
SubscriptionPurchase subscripcion = get.execute(); //LINE 1
In Google APIS Console the Service "Google Play Android Developer API" is enabled.
GOOGLE_CLIENT_MAIL is the email address from API Access from the Google Console.
GOOGLE_KEY_FILE_PATH is the p12 file downloaded from the API Access.
GOOGLE_PRODUCT_NAME is the product name from the branding information.
The code return in LINE 1:
"domain" : "androidpublisher",
"message" : "This developer account does not own the application.",
"reason" : "developerDoesNotOwnApplication"
Original issue: http://code.google.com/p/google-api-java-client/issues/detail?id=533