dash-google-auth icon indicating copy to clipboard operation
dash-google-auth copied to clipboard

No Google+ API traffic displayed on the Google Developers Console

Open delaleva opened this issue 7 years ago • 2 comments

I've been using your Google OAuth example in my Dash app but I ran into two different problems. Before your recent update, I was getting a user rate limit quota error even though my application was not making more than 500 requests every 100 seconds. After the changes, however, I don't get this error but when I checked how much I was using in terms of requests on the console, no traffic was shown. The same happens when I use your example app. Why is this happening? I guess the requests are not associated with an API console project correctly or maybe Google OAuth doesn't work as expected.

delaleva avatar Sep 04 '18 09:09 delaleva

Previously I enabled the Google+ API and then I could see my usage and set limits. Do I need to enable some other API now since the scope has been changed?

delaleva avatar Sep 04 '18 13:09 delaleva

I modified the auth process to skip the Google+ call since it's unnecessary. You are right though that there's no way (as far as I'm aware) to track OAuth API calls via the Google console. If you still want to do this with Google+, you could simply add back a call without doing anything with the response:

    def is_authorized(self):
        if not google.authorized:
            # send to google login
            return False

        resp = google.get("/oauth2/v2/userinfo")
        assert resp.ok, resp.text
        
+       # make additional google+ call for tracking purposes
+       google.get("/plus/v1/people/me")
        
        email = resp.json()["email"]
        if email in self.authorized_emails:
            # send to index
            return True
        else:
            # unauthorized email
            return abort(403)

lchapo avatar Sep 04 '18 20:09 lchapo