Enable client reuse when authenticating with app user access tokens#740
Merged
XAMPPRocky merged 1 commit intoJan 13, 2025
Merged
Conversation
Contributor
Author
|
Immediately after posting this PR I found: octocrab/examples/custom_client.rs Line 22 in fae5b08 I think that'd solve my issue. Though there is still value in enabling reuse in the manner of this PR. I'm hoping maintainers will have an opinion |
Owner
|
Thank you for your PR! |
Merged
kyle-leonhard
added a commit
to kosolabs/koso
that referenced
this pull request
Feb 26, 2025
I added support for reuse in XAMPPRocky/octocrab#740
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows octocrab instances to be reused with different Github app user access tokens, similar the
installationfunction enabling an instance to be reused with different installations of an app.The motivation is to avoid creating a new connection every time a request needs made for a different user, user access token. I didn't see any good way to reuse or provide the connection created in
build(code)Here's how it looks:
An alternative is to expose an
Octocrab::toBuildermethod to effectively clone the existing client with varying configuration. This looks hard given how configuration ends up embedded in service layers.User access token documentation: https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app