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

How to get this working? #36

Open
gilblau opened this issue Feb 28, 2018 · 1 comment
Open

How to get this working? #36

gilblau opened this issue Feb 28, 2018 · 1 comment

Comments

@gilblau
Copy link

gilblau commented Feb 28, 2018

Hi,
Can you please assist????
I am trying to use this plugin using docker. For some reason I don't seem to be able to get my python code to authenticate with GCP.
I keep getting the following error message:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/boto/storage_uri.py", line 569, in create_bucket
conn = self.connect()
File "/usr/local/lib/python2.7/dist-packages/boto/storage_uri.py", line 140, in connect
**connection_args)
File "/usr/local/lib/python2.7/dist-packages/boto/gs/connection.py", line 47, in init
suppress_consec_slashes=suppress_consec_slashes)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/connection.py", line 194, in init
validate_certs=validate_certs, profile_name=profile_name)
File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 569, in init
host, config, self.provider, self._required_auth_capability())
File "/usr/local/lib/python2.7/dist-packages/boto/auth.py", line 1021, in get_auth_handler
'Check your credentials' % (len(names), str(names)))
boto.exception.NoAuthHandlerFound: No handler was ready to authenticate. 3 handlers were checked. ['OAuth2Auth', 'OAuth2ServiceAccountAuth', 'HmacAuthV1Handler'] Check your credentials

Steps:

python
import boto
import gcs_oauth2_boto_plugin
OAUTH2_CLIENT_ID = 'client_id'
OAUTH2_CLIENT_SECRET = 'client_secret'
gcs_oauth2_boto_plugin.SetFallbackClientIdAndSecret(OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET)
project_id='project_id' //I have my project id
header_values = {"x-goog-project-id": project_id}
uri = boto.storage_uri('my-bucket', 'gs')
uri.create_bucket()

@kevinoid
Copy link

I just encountered the same error:

boto.exception.NoAuthHandlerFound: No handler was ready to authenticate. 3 handlers were checked. ['OAuth2Auth', 'OAuth2ServiceAccountAuth', 'HmacAuthV1Handler'] Check your credentials

In my case the problem was that I had added client_id and client_secret to the [OAuth2] section of ~/.boto but had not run gsutil config which adds gs_oauth2_refresh_token to the [Credentials] section. After running gsutil config and granting access via the OAuth prompt the error was resolved for me.

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

No branches or pull requests

2 participants