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

Adding auth doc explaining all the ways to mint credentials. #805

Closed
wants to merge 1 commit into from

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Apr 7, 2015

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 7, 2015
(and is an e-mail address)
and the password is actually a private key file.
A `Service Account`_ handles authentication for a backend service that
needs to talk to other services (e.g. Google APIs).

This comment was marked as spam.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 06918f1 on dhermes:add-gcloud-auth-docs into * on GoogleCloudPlatform:master*.

@tseaver
Copy link
Contributor

tseaver commented Apr 7, 2015

LGTM

@dhermes
Copy link
Contributor Author

dhermes commented Apr 7, 2015

@tseaver Thanks for the review, I'll hold off on merging until @jgeewax takes a look.

Basic Example
=============

After downloading a JSON key for a service account (see `Service Accounts`_),

This comment was marked as spam.

This comment was marked as spam.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling f6bba7b on dhermes:add-gcloud-auth-docs into * on GoogleCloudPlatform:master*.

@dhermes
Copy link
Contributor Author

dhermes commented Apr 9, 2015

@jgeewax PTAL

@jgeewax
Copy link
Contributor

jgeewax commented Apr 15, 2015

OK, I was just attempting to explain to someone how this might work, and realized that, when coming from a totally fresh spot, it was much less helpful than I'd hoped. It feels a bit like "here is a page of formulas organized by complexity of the code you have to write" rather than "here's the tasks you might want to do and how you get them done".


Are there any objections to making this more "use-case" oriented? The way I'd picture it is:

Ways to authenticate

Use the 'default credentials'

If you're running in any of the following environments, we can detect both your credentials and the project ID (and dataset ID for Cloud Datastore) automatically:

  • GAE
  • ...

This means that in those environments, the following will 'just work':

from gcloud import datastore
datastore.get(...)

Specify a particular set of credentials

If you want to be explicit about the credentials, do that by using [insert detail here]:

# Note: I still think this is too long...

from gcloud import credentials
from gcloud import datastore

creds = credentials.get_for_service_account_json('/path/to/key.json')
datastore.set_default_connection(datastore.Connection(credentials=creds))

...

@tmatsuo
Copy link
Contributor

tmatsuo commented Apr 15, 2015

JFYI, I wrote a doc about usable auth recently:
https://cloud.google.com/pubsub/configure

I also feel that we should advertise the simplest case (and most importantly, you can have the portable code which runs everywhere) first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add auth doc; Document 3LO via "gcloud login"
6 participants