Support » Plugins and Hacks » [Resolved] Keeps asking us to authorize

[Resolved] Keeps asking us to authorize

  • We’re testing this plugin in on several of our websites, some are multisite installs and others standalone. The plugin seems to work great when it’s first setup in either situation but after a few days when I go back to the site, I find it’s asking for authorization again.

    Why does this keep happening?
    Does it need the user to be logged into the correct Google account at all times?


Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author Alin Marcu



    No, look in General Settings -> Debugging Data for errors and in your PHP error log.

    Hi Alin,
    Thanks for the reply. Last error:

    Last Error: exception 'Google_AuthException' with message 'Error refreshing the OAuth2 token, message: '{
      "error" : "invalid_grant"
    }'' in /data/COLA/wp-content/plugins/google-analytics-dashboard-for-wp/tools/src/auth/Google_OAuth2.php:288
    Plugin Author Alin Marcu



    Can you check the clock on your server and make sure is synced with NTP?

    I’m not sure how to do that so I’ve asked the host’s support team. Will let you know. Thanks.

    Hello Alin,
    That seems to have done the trick. Thank you. Turns out the issues was in the PHP.ini file. Datetimezone was commented out. Set this and all seems to be working fine.

    Meh… still happening. I’ve checked and made sure NTP is set to the servers in our location:

    server 0.north-america.pool.ntp.org
    	   server 1.north-america.pool.ntp.org
    	   server 2.north-america.pool.ntp.org
    	   server 3.north-america.pool.ntp.org

    PHP.ini is set correctly as well.

    Still getting this error:

    Last Error: exception 'Google_AuthException' with message 'Error refreshing the OAuth2 token, message: '{
      "error" : "invalid_grant"
    }'' in /wp-content/plugins/google-analytics-dashboard-for-wp/tools/src/auth/Google_OAuth2.php:288
    Stack trace:
    #0 /wp-content/plugins/google-analytics-dashboard-for-wp/tools/src/auth/Google_OAuth2.php(248): Google_OAuth2->refreshTokenRequest(Array)
    #1 /wp-content/plugins/google-analytics-dashboard-for-wp/tools/src/Google_Client.php(311): Google_OAuth2->refreshToken('1/u16MQiGZ_R9fZ...')
    #2 /wp-content/plugins/google-analytics-dashboard-for-wp/tools/gapi.php(141): Google_Client->refreshToken('1/u16MQiGZ_R9fZ...')
    #3 /wp-content/plugins/google-analytics-dashboard-for-wp/tools/gapi.php(47): GADASH_GAPI->ga_dash_refresh_token()
    #4 /wp-content/plugins/google-analytics-dashboard-for-wp/tools/gapi.php(1090): GADASH_GAPI->__construct()
    #5 /wp-content/plugins/google-analytics-dashboard-for-wp/admin/dashboard_widgets.php(140): include_once('/wp-c...')
    #6 [internal function]: GADASH_Widgets->gadash_dashboard_widgets('', Array)
    #7 /wp-admin/includes/template.php(985): call_user_func(Array, '', Array)
    #8 /wp-admin/includes/dashboard.php(193): do_meta_boxes('dashboard', 'side', '')
    #9 /wp-admin/index.php(125): wp_dashboard()
    #10 {main}

    Is there a limit to the number of GA Accounts or properties the plugin can work with?

    Plugin Author Alin Marcu



    The plugin has no limit for the number of GA accounts or properties, but there is a limit of 25 tokens per Google Analytics account (this limit is imposed by Google).

    You can receive an invalid grant when:

    1. server’s clock is not synced with NTP
    2. the refresh token limit has been exceeded

    you can read more about that here (see the last paragraph):


    The 25 token limit must be the issue. We have all of our University web properties under one GA user. Seems like the solution would be to divide up the properties among different GA users?

    Odd – In the error log I see a bunch of properties that no longer exist in my GA account. Are they cached somehow?

    Plugin Author Alin Marcu



    The only way to refresh the web properties list is to clear the authorization and authorize again.

    Each website can have its own GA account and using User Management feature all properties can be shared with your account (for example). You can also use this feature to easily transfer properties between accounts without loosing stats.

    I don’t know exactly your organizational chart but you should be able to organize in such a way that a single GA account wont need to authorize more than 25 websites.

    I tried clearing the authorization but they still show up. These are in the error log – not the property selection. Is there a way to clear the log?

    I have several “Accounts” under one GA User. Then each of the Accounts can have up to 10 “Properties”. We have 55 Properties in total and each one needs access to it’s own GA on the dashboard. I’m wondering if I need to create more accounts or Google users and split the Accounts between the users?

    Plugin Author Alin Marcu



    I’m thinking about adding an option on WPMU to authorize only once for the entire network, from Network Admin dashboard. I think this will solve your issue and will increase WPMU compatibility.

    That would be great Alin but do you have a timeline for completing that project?

    Hi Alin,

    I have the same problem. When I ask for a new access code for a new sub-site then the stats are the same as on the main-site.

    It would be great to have the option to authorize only once for a multisite installation. i think that in this way should work better.

    Please keep us update on this.
    Best thanks.

    Plugin Author Alin Marcu



    @pcasciaro please open your own topic, your problem is not related to this topic.

    @lorax most probably with the 4.3 release, it may take a while.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘[Resolved] Keeps asking us to authorize’ is closed to new replies.