• Resolved mediagraaf

    (@mediagraaf)


    Hello,

    We have the paid version of the plugin but every couple of days (±10?) we need to reconnect Google Analytics due to error code [400].

    The debug gives the following report:

    {
     "url": "https://accounts.google.com/o/oauth2/token",
     "request": {
      "client_id": "XXXX.apps.googleusercontent.com",
      "refresh_token": "XXXX",
      "grant_type": "refresh_token"
     },
     "reply": {
      "error": "invalid_grant",
      "error_description": "Bad Request"
     }
    }

    The solution is to reset all data and start over, but how can we prevent this?

Viewing 1 replies (of 1 total)
  • Plugin Contributor Lara Google Analytics – Support

    (@laragoogleanalytics)

    Hello @mediagraaf,

    This is a limitation imposed by Google : https://developers.google.com/identity/protocols/oauth2#expiration

    Google API currently has a limit of 50 (25 for some accounts) refresh tokens per user account per client. If the limit is reached, creating a new refresh token automatically invalidates the oldest refresh token without warning.

    So for example, If you have authorized the widget on 50 sites, then tried to authorize it on another site, the first site will start receiving “[invalid_grant] Bad Request”.

    One way to go around this, is to use multiple Google accounts.

    Or since the limit is per user account per client, the advanced setup may help, as with it, you will be able to create a new google app (client).

    Each client can handle 50 active tokens from one Google account, so you will need to create multiple google apps (clients), and each should handle 50 tokens (sites).

    I hope it is clear now.

Viewing 1 replies (of 1 total)
  • The topic ‘Every couple of days (±10?) error code [400]: refresh_token’ is closed to new replies.