Skip to content

Crash while scoping credentials #327

@wwlian

Description

@wwlian

When googleapiclient._auth.with_scopes(...) gets called (e.g., as a consequence of calling googleapiclient.discovery.build(...)) in an environment with google-auth and google-auth-httplib2 installed, the following crash occurs:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/googleapiclient/discovery.py", line 226, in build
credentials=credentials)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/googleapiclient/discovery.py", line 361, in build_from_document
credentials = _auth.with_scopes(credentials, scopes)
File "/usr/local/lib/python2.7/dist-packages/googleapiclient/_auth.py", line 61, in with_scopes
credentials, google.auth.credentials.Credentials):
AttributeError: 'module' object has no attribute 'credentials'

This appears to be because googleapiclient._auth.with_scopes(...) attempts to test if the credentials object is an instance of google.auth.credentials.Credentials, but google.auth.credentials is never imported. Testing most likely missed this bug because the module containing the test for _auth.with_scopes(...) imports google.auth.credentials.

Metadata

Metadata

Labels

🚨This issue needs some love.triage meI really want to be triaged.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions