Use JSON credential of service account instead of oauth token

This commit is contained in:
Jumpei Tsuji
2015-05-26 23:42:30 +09:00
parent 74d18f9aa3
commit 7c39cf1775
3 changed files with 56 additions and 204 deletions

View File

@@ -54,13 +54,14 @@ import(
)
func main() {
// You need to prepare an authorization code or a refresh token.
// If you have a refresh token, you can generate an oauth token like this.
token := &oauth2.Token{
RefreshToken: "your refresh token",
// You need to prepare a public key for your Android app's in app billing
// at https://console.developers.google.com.
jsonKey, err := ioutil.ReadFile("jsonKey.json")
if err != nil {
log.Fatal(err)
}
client := playstore.New(token)
client := playstore.New(jsonKey)
resp, err := client.VerifySubscription("package", "subscriptionID", "purchaseToken")
}
```