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

DM-39710: Patch create_app_client to preset JWT #182

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jonathansick
Copy link
Member

This fixes GitHubAppClientFactory.create_app_client. I mistakenly though that the oauth_token attribute on the GitHubAPI constructor could be used to cache the app's JWT. It turns out that the JWT is treated entirely separately, and currently can't be cached in GitHubAPI. Instead, the JWT needs to be passed to each request method. This commit achieves the desired behaviour by patching the Gidgethub GitHubAPI methods to always set the jwt keyword argument.

This fixes GitHubAppClientFactory.create_app_client. I mistakenly though
that the oauth_token attribute on the GitHubAPI constructor could be
used to cache the app's JWT. It turns out that the JWT is treated
entirely separately, and currently can't be cached in GitHubAPI.
Instead, the JWT needs to be passed to each request method. This commit
achieves the desired behaviour by patching the Gidgethub GitHubAPI
methods to always set the jwt keyword argument.
Rather than monkeypatch GitHubAPI to cache the JWT, it's type-safer to
create a new class with new methods that work with app authentication
and cached JWTs.
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

Successfully merging this pull request may close these issues.

1 participant