Skip to content

Google subscription and refresh token issue #359

Description

@pierroo

I am struggling to properly setup google verification of subscription.
I followed the docs to get the mandatory keys for iap.config:

googleAccToken: process.env.GOOGLE_ACC_TOKEN, // optional, for Google Play subscriptions
googleRefToken: process.env.GOOGLE_REF_TOKEN, // optional, for Google Play subscritions
googleClientID: process.env.GOOGLE_CLIENT_ID, // optional, for Google Play subscriptions
googleClientSecret: process.env.GOOGLE_CLIENT_SECRET, // optional, for Google Play subscriptions

I placed those access token and refresh token in .env file, and I got them from https://developers.google.com/oauthplayground as mentioned in the docs.

HOWEVER, the refresh token clearly expires every 3600 seconds.

I added it to my server (on heroku), it worked great for the first few days, and then a few hours ago all payments validation would crash with the following:

{"error":{},"status":1,"message":"{\"statusCode\":400,\"body\":{\"error\":\"invalid_grant\",\"error_description\":\"Token has been expired or revoked.\"}, ....

Whether consumable or subscription, the iap.validate will now always crash.
Of course when I manually regenerate the access and refresh token following the docs it will work again, but for how long??

Maybe I misunderstood, but instead of those expiring access and refresh token, is there any way to use a google service account instead?
I am not sure how this would work, the documentation may be outdated or vague about it.

Any help would be GREATLY appreciated!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions