-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Enable auth via oauth2client: 3LO, Implicit from Environ, p12 and JSON service account #335
Comments
I've been talking with @craigcitro this morning about moving parts of the credentials dance implemented in apitools into the oauth2client, I'll work on that this afternoon. |
w00t I'm happy to help do this, I have done a fair amount of work in |
If you want to do it, it's all yours :) |
+1, happy to accept pull requests -- as a heads-up, i'm about to do a giant merge over in |
|
@dhermes for 2) we can VC if you want, I'm busy now but I'll be free in the afternoon. |
giant merge is done, oauth2client now supports python3 at HEAD. (w00t!) |
@craigcitro is googleapis/google-api-python-client@0bf61f2 the relevant commit? I assume the October 15 date is because that's when you committed it locally? |
nope, googleapis/oauth2client@0dacff1 -- oauth2client is in its own repo now. |
DERP. My bad. |
@silvolu just had a chat with @craigcitro and hope to tackle this soon. Luckily most is handled by |
I'll try to tackle 3LO with a user-flow this week. |
Addresses final part of googleapis#335.
Addresses final part of googleapis#335.
@silvolu Adding 3LO is as simple as documenting
and then telling them to call from gcloud import credentials
creds = credentials.get_credentials() If using just Datastore it's even more "just works": from gcloud import datastore
datastore.set_defaults() Where do you think this should go? |
In the gcloud-node docs the auth bits are in the snippets contained in the 'getting started with gcloud' section, but I think this is more relevant to using the demos we provide with gcloud-python, so it should probably go in the 'API x in 10 seconds' sections. @jgeewax ? |
Would it make sense to have an "Authentication" section at the same hierarchy level as each of the services ? If I'm a developer and I'm trying to get set up, the "... in 10 seconds" pages are great, but I might want more detail about stuff. 3LO is a "more detail" thing. "... in 10 seconds" would be how the typical person does this (and typically, I'd use a service account with 2LO). Thoughts? |
It's currently showing how to use the demo, which is why it's where it makes sense to use 3LO (authorized with gcloud cli and reuse credentials vs create project, download key etc) |
Might be worthwhile to toss in: If I already have the Cloud SDK and the goal is "quickest way to get code actually working", then the gcloud auth login + datastore.set_defaults() is the fastest option. If they don't already have the SDK (which a lot of people don't -- nor do they want it...) then this is not the fastest way to get this moving. Further, if we're measuring time from pip install to "running code on a server somewhere", then they'll have to use 2LO anyway, so they'll have to create a service account, pull down the key, and write code that uses that key (assuming they are not on GAE or GCE). I'm in the group where I expect that talking to some outside service needs a "config.py" file of some sort (ie Django with settings.py) -- and I want to get that done right away. If there's magical "oh don't worry we hooked all the stuff together" then come deployment time I'm not the happiest camper because learning time is supposed to be coming to an end (maybe I'm the exception here). There's the edge case of "if I'm running in GCE", but unfortunately it is absurdly easy to screw this up (you have to click Advanced on your image at creation time and make sure that Datastore and whatever else is enabled -- otherwise you have to start over...) Because of that, I'd want to highlight 2LO as "the way" to do this (including the "get a service account, pull down a JSON file, etc), and document 3LO as well, but not right in your face in the "... in 10 seconds" route. Tell me if I'm totally crazy on this. |
Source-Link: googleapis/synthtool@82f5cb2 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
Source-Link: googleapis/synthtool@82f5cb2 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
Source-Link: googleapis/synthtool@82f5cb2 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Source-Link: https://togithub.com/googleapis/synthtool/commit/26c7505b2f76981ec1707b851e1595c8c06e90fc Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790
* fix: change timeout settings for SearchJobsForAlert PiperOrigin-RevId: 528815611 Source-Link: googleapis/googleapis@b473ccc Source-Link: googleapis/googleapis-gen@4efc7a2 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGVmYzdhMjIyMDhkNzVkMDYzNGNiMDQ2MTQ5MDk1NGRkNjlmYzZkZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 451250442 Source-Link: googleapis/googleapis@cca5e81 Source-Link: googleapis/googleapis-gen@0b219da Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGIyMTlkYTE2MWE4YmRjYzNjNmY3YjJlZmNkODIxMDUxODJhMzBjYSJ9
fix(deps): require proto-plus >= 1.22.0
* fix: remove delays from LRO operations samples. * fix linters. * fix logic. * fix linters. Co-authored-by: Anthonios Partheniou <[email protected]>
…335) Source-Link: https://togithub.com/googleapis/synthtool/commit/395d53adeeacfca00b73abf197f65f3c17c8f1e9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:6c1cbc75c74b8bdd71dada2fa1677e9d6d78a889e9a70ee75b93d1d0543f96e1
Source-Link: https://togithub.com/googleapis/synthtool/commit/26c7505b2f76981ec1707b851e1595c8c06e90fc Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790
Co-authored-by: Anthonios Partheniou <[email protected]>
Source-Link: https://togithub.com/googleapis/synthtool/commit/30bd01b4ab78bf1b2a425816e15b3e7e090993dd Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:9bc5fa3b62b091f60614c08a7fb4fd1d3e1678e326f34dd66ce1eefb5dc3267b
…p/templates/python_library/.kokoro (#335) Source-Link: https://togithub.com/googleapis/synthtool/commit/bb171351c3946d3c3c32e60f5f18cee8c464ec51 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f62c53736eccb0c4934a3ea9316e0d57696bb49c1a7c86c726e9bb8a2f87dadf
* chore: exclude requirements.txt file from renovate-bot Source-Link: googleapis/synthtool@f58d313 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7a40313731a7cb1454eef6b33d3446ebb121836738dc3ab3d2d3ded5268c35b6 * update constraints files * fix(deps): require protobuf 3.20.2 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
Source-Link: googleapis/synthtool@050953d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:65e656411895bff71cffcae97246966460160028f253c2e45b7a25d805a5b142 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore: update Java and Python dependencies PiperOrigin-RevId: 408420890 Source-Link: googleapis/googleapis@2921f9f Source-Link: googleapis/googleapis-gen@6598ca8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU5OGNhOGNiYmY1MjI2NzMzYTA5OWM0NTA2NTE4YTVhZjZmZjc0YyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@56da63e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:993a058718e84a82fda04c3177e58f0a43281a996c7c395e0a56ccc4d6d210d7
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
) Source-Link: googleapis/synthtool@7804ade Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* docs: Fix formatting of request arg in docstring chore: Update gapic-generator-python to v1.9.1 PiperOrigin-RevId: 518604533 Source-Link: googleapis/googleapis@8a085ae Source-Link: googleapis/googleapis-gen@b2ab4b0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJhYjRiMGEwYWUyOTA3ZTgxMmMyMDkxOThhNzRlMDg5OGFmY2IwNCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: https://togithub.com/googleapis/synthtool/commit/26c7505b2f76981ec1707b851e1595c8c06e90fc Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790
Source-Link: googleapis/synthtool@82f5cb2 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
Source-Link: https://togithub.com/googleapis/synthtool/commit/dede53ff326079b457cfb1aae5bbdc82cbb51dc3 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:fac304457974bb530cc5396abd4ab25d26a469cd3bc97cbfb18c8d4324c584eb
Please leave this on hold until we move the credential dance into oauth2client and update apitools, I will update this issue tomorrow.Things to be done (added by @dhermes):
oauth2client.client.GoogleCredentials.get_application_default()
.This still is "open" due to Detecting GCE sometimes takes forever. oauth2client#93get_application_default
)get_application_default
)get_application_default
)gcloud.credentials.get_for_service_account_p12
)The text was updated successfully, but these errors were encountered: