Reputation: 27232
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
Upvotes: 1
Views: 1244
Reputation: 1560
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
Upvotes: 0
Reputation: 117291
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:
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.
Upvotes: 4