googleads / google-ads-python

Google Ads API Client Library for Python
Apache License 2.0
526 stars 480 forks source link

this should be false #810

Closed abcubed3 closed 1 year ago

abcubed3 commented 1 year ago

https://github.com/googleads/google-ads-python/blob/310a10b18f3ce91fc5c885f63ba090641972fbe1/examples/authentication/generate_user_credentials.py#L72

I keep getting error Traceback (most recent call last): File "generate_user_credentials.py", line 209, in <module> main(args.client_secrets_path, configured_scopes) File "generate_user_credentials.py", line 88, in main flow.fetch_token(code=code) File "/usr/local/lib/python3.8/site-packages/google_auth_oauthlib/flow.py", line 285, in fetch_token return self.oauth2session.fetch_token(self.client_config["token_uri"], **kwargs) File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 360, in fetch_token self._client.parse_request_body_response(r.text, scope=self.scope) File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response validate_token_parameters(params) File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 461, in validate_token_parameters raise w Warning: Scope has changed from "https://www.googleapis.com/auth/adwords" to "openid https://www.googleapis.com/auth/adwords https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email".

This SO answer resolved it by changing true to false

BenRKarl commented 1 year ago

@abcubed3 thanks for this. I think setting this parameter to true is best practice for the majority of use-cases. My assumption is that you've added scopes to your OAuth profile after the last time you generated a refresh token? If that's the case, then this appears to be working as intended, and you should manually change that field to false.