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

feat: enable self signed jwt for service account credentials #1553

Merged
merged 1 commit into from Oct 7, 2021

Conversation

@arithmetic1728
Copy link
Contributor

@arithmetic1728 arithmetic1728 commented Oct 6, 2021

Enable self signed jwt if google-auth service account credentials are used.

Tested with Storage, Compute and PubSub APIs:

import googleapiclient.discovery

project = "<project>"
zone = "us-west1-a"

compute = googleapiclient.discovery.build('compute', 'v1')
result = compute.instances().list(project=project, zone=zone).execute()
print(result)

storage = googleapiclient.discovery.build('storage', 'v1')
result = storage.buckets().list(project=project).execute()
print(result)

topic = "<topic>"
pubsub = googleapiclient.discovery.build('pubsub', 'v1')
result = pubsub.projects().topics().get(topic=f"projects/{project}/topics/{topic}").execute()
print(result)
@google-cla google-cla bot added the cla: yes label Oct 6, 2021
@arithmetic1728 arithmetic1728 marked this pull request as ready for review Oct 6, 2021
@arithmetic1728 arithmetic1728 requested a review from as a code owner Oct 6, 2021
@arithmetic1728 arithmetic1728 requested a review from busunkim96 Oct 6, 2021
@busunkim96
Copy link
Contributor

@busunkim96 busunkim96 commented Oct 7, 2021

@arithmetic1728 I vaguely remember being told this was only implemented for GAPICs as self-signed JWT isn't guaranteed to work for all the APIs listed in the directory. Is that a non-issue now?

Loading

@gcf-merge-on-green gcf-merge-on-green bot merged commit 1fb3c8e into main Oct 7, 2021
10 of 11 checks passed
Loading
@gcf-merge-on-green gcf-merge-on-green bot deleted the jwt branch Oct 7, 2021
@vriesk
Copy link

@vriesk vriesk commented Oct 12, 2021

Hi!

This breaks (at least) the drive/v3 files list API (server starts throwing 500s). Manually disabling this with build(.... always_use_jwt_access=False) makes it work again.

Loading

@arithmetic1728
Copy link
Contributor Author

@arithmetic1728 arithmetic1728 commented Oct 12, 2021

@vriesk Thank you for bringing it up. I tested with the following sample, it did break. Will investigate more.

import googleapiclient.discovery

drive = googleapiclient.discovery.build('drive', 'v3', always_use_jwt_access=True)
result = drive.files().list(corpora="user").execute()
print(result)

Loading

@arithmetic1728
Copy link
Contributor Author

@arithmetic1728 arithmetic1728 commented Oct 12, 2021

Created PR #1566 to disable self signed jwt.

Loading

@vriesk
Copy link

@vriesk vriesk commented Oct 13, 2021

Thanks for the quick fix. :)

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants