googleanalytics / google-analytics-super-proxy

Publicly share your Google Analytics reporting data.
Other
224 stars 99 forks source link

How to configure super proxy to request authorization for both the core & real-time apis? #6

Closed AtariDHD closed 11 years ago

AtariDHD commented 11 years ago

Thanks so much for your great work. I followed your video tutorial and things went swimmingly. :) Pie-chart goodness working. Awesome!

Along with data from the Core Reporting API, I want to pull data from the Real Time Reporting API. I attempted to set up a real time query through the super proxy admin and received an error:

GET https://www.googleapis.com/analytics/v3/data/realtime?ids=ga%3A{MY_PROFILE_ID}&metrics=ga%3AactiveVisitors&max-results=1

RETURNED {u'error': {u'code': 403, u'message': u'Your project does not have access to this feature.', u'errors': [{u'domain': u'global', u'message': u'Your project does not have access to this feature.', u'reason': u'insufficientPermissions'}]}}

I've read through the page on authorization for real time api requests at https://developers.google.com/analytics/devguides/reporting/realtime/v3/authorization and it says "You will get a 403 status code if the authorized user does not have access to the view (profile). Make sure you are authorized with the correct user and that they indeed have the view (profile) you have selected." I am authorizing with the correct user and I'm able to access the real time data through the main Google Analytics UI and through the test page at https://developers.google.com/analytics/devguides/reporting/realtime/v3/reference/data/realtime/get using the same user.

In your analytics_auth_helper.py, you set the OAUTH scope to https://www.googleapis.com/auth/analytics.readonly As far as I can tell, that works for the real time API too.

The only other thing that I've spotted is that the real time authorization documentation mentions "Activate the Real Time Reporting API in the Services pane of the Google APIs Console. (If it isn't listed in the Console, then skip this step.)" It wasn't there.

I'm stumped. Any ideas?

Thanks!

pfrisella commented 11 years ago

It does work with the Real Time Reporting API. However, this API is currently in private beta so you need to be whitelisted to access this API as per the blog post announcement and there is a notice at the top of Real Time Reporting API developer pages. I'll get the other pages updated to make this more clear.

If you don't have whitelist access you'll receive the error as you described.