There is an email address associated with your service account.
For this, appropriate permissions are required both in the dev console and in Play. Remember to add your business address to the Play store.
What I came up with is to use
var googleAuth = require('google-oauth-jwt'), authObject = { email: ' blahblahtrutjtrutj@developer.gserviceaccount.com ', keyFile: 'purchases-test.pem', scopes: ['https://www.googleapis.com/auth/androidpublisher'] }; googleAuth.authenticate(authObject, function (err, token) { next(err, token); });
I store the token in redis for an hour and use this token to make my request to the repository:
var opts = { url : verifyUrl + payload.packageName + '/inapp/' + payload.productId + '/purchases/' + payload.token, headers: { authorization : 'Bearer ' + token } }; request.get(opts, function (error, response, body) { next(error, response, body); });
source share