GoogleCloudPlatform / gcs-oauth2-boto-plugin

Auth plugin allowing use the use of OAuth 2.0 credentials for Google Cloud Storage in the Boto library.
Apache License 2.0
21 stars 38 forks source link

Error with boto / service key file #28

Closed grivescorbett closed 8 years ago

grivescorbett commented 8 years ago

Here's the code I'm using:

boto.config.add_section('Credentials')
boto.config.set('Credentials', 'gs_service_key_file', '/path/to/service/account.json')
boto.config.set('Credentials', 'gs_service_client_id', 'user@project.iam.gserviceaccount.com')
connection = boto.connect_s3(provider='google')
my_bucket = connection.get_bucket('my-cool-bucket')

and the error I'm seeing:

  File "/usr/local/lib/python2.7/site-packages/gcs_oauth2_boto_plugin/oauth2_client.py", line 322, in GetAccessToken
    access_token = self.FetchAccessToken()
  File "/usr/local/lib/python2.7/site-packages/gcs_oauth2_boto_plugin/oauth2_client.py", line 393, in FetchAccessToken
    credentials = self.GetCredentials()
  File "/usr/local/lib/python2.7/site-packages/gcs_oauth2_boto_plugin/oauth2_client.py", line 523, in GetCredentials
    scopes=[DEFAULT_SCOPE])
TypeError: __init__() takes at least 3 arguments (4 given)

It looks like the init signature for ServiceAccountCredentials takes an additional parameter called signer which is not being sent. Is my approach incorrect or does this need to be changed?

grivescorbett commented 8 years ago

Update: I was able to get further by downgrading oauth2client to version 1.5.2, however now I'm getting the error: GSResponseError: 400 Bad Request

grivescorbett commented 8 years ago

Got it! Just needed boto.connect_s3(provider='google', host='storage.googleapis.com')