Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update google.py #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

SmartManoj
Copy link

No description provided.

@mkell43
Copy link

mkell43 commented Apr 13, 2020

👍 Thanks @SmartManoj hopefully they get this merged in sometime soon.

@singingwolfboy
Copy link
Owner

I just saw this pull request. Could you please give it a meaningful title and description, explaining why this change is important? I see that Google lists these scopes in the documentation, but the scopes that are already in this project seem to work fine for me.

If they do not work for you, please let me know. I'd rather not change this code for no reason.

@SmartManoj
Copy link
Author

Only this scope worked for me. Maybe something changed now.

@rushiagr
Copy link

I can second @SmartManoj . Copy-pasting doesn't work out of the box. Had to make the suggested change. The error I got, for reference, was

DEBUG:requests_oauthlib.oauth2_session:Invoking 0 token response hooks.
ERROR:dataapp:Exception on /login/google/authorized [GET]
Traceback (most recent call last):
  File "/home/ubuntu/.sandesh/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/ubuntu/.sandesh/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ubuntu/.sandesh/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ubuntu/.sandesh/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/ubuntu/.sandesh/lib/python3.9/site-packages/flask_dance/consumer/oauth2.py", line 263, in authorized
    token = self.session.fetch_token(
  File "/home/ubuntu/.sandesh/lib/python3.9/site-packages/requests_oauthlib/oauth2_session.py", line 366, in fetch_token
    self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/home/ubuntu/.sandesh/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 448, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/home/ubuntu/.sandesh/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in parse_token_response
    validate_token_parameters(params)
  File "/home/ubuntu/.sandesh/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 471, in validate_token_parameters
    raise w
Warning: Scope has changed from "profile email" to "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid".

Maybe it is because OAUTHLIB_RELAX_TOKEN_SCOPE is set to true in your case @singingwolfboy ? It wasn't in my case.

@rushiagr
Copy link

BTW, setting app.config["OAUTHLIB_RELAX_TOKEN_SCOPE"] = True in code didn't work either. I guess this is because the param can only be set as an environment var, as I can see in oauthlib/oauth2/rfc6749/parameters.py file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants