1

I'm implementing google analytics Api.

Authorization is done without problems.After successfully authorization i get 403 return code and get the message : User does not have sufficient permissions for this profile.

My account has google analytics data, tracking multiple websites, and I can access it from web browser without problem. I've allowed Analytics api through google apis console.

Here is the Response i get after successfull authorization :

array(2) {
  ["http_code"]=>
  int(403)
  ["error"]=>
  array(3) {
    ["errors"]=>
    array(1) {
      [0]=>
      array(3) {
        ["domain"]=>
        string(6) "global"
        ["reason"]=>
        string(23) "insufficientPermissions"
        ["message"]=>
        string(59) "User does not have sufficient permissions for this profile."
      }
    }
    ["code"]=>
    int(403)
    ["message"]=>
    string(59) "User does not have sufficient permissions for this profile."
  }
}

Any immediate help will be highly appreciable. Thanks

0

2 Answers 2

4

The Google Account you are using to authenticate with does not have access to the Google Analytics profile / view you are trying to look access.

Optioions:

  1. Login with an account that has access to that profile.
  2. Give the user that you are loging in with access to that profile
  3. double check you have the right profile id :)

In the event you are using a Service account take the service account email address and add it as a user at the ACCOUNT level to the Google Analytics account as you would any user.

1
0

That error is common when you didn't grant the access or the token has expired,try to check these parameters. to do this you have to attack the following scope.

https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=xxxxxxxxxxxx

(remember replace the x for your token)

{
         "azp": "1044214436568-xxxxxxxxxxx.apps.googleusercontent.com",
         "aud": "1044214436568-xxxxxxxxxxxxxx.apps.googleusercontent.com",
         "scope": "https://www.googleapis.com/auth/analytics.readonly",
         "exp": "1467026930",
         "expires_in": "3287",
         "access_type": "offline"
}

Try to hit the correct scope parameter (in this case "https://www.googleapis.com/auth/analytics.readonly") with the correct token

If you need more help, add this information to see where is you error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.