Skip to content

baton-github: override static token with reuseToken in appClient#123

Merged
Bencheng21 merged 1 commit intomainfrom
ben/refresh_jwttoken
Feb 6, 2026
Merged

baton-github: override static token with reuseToken in appClient#123
Bencheng21 merged 1 commit intomainfrom
ben/refresh_jwttoken

Conversation

@Bencheng21
Copy link
Contributor

@Bencheng21 Bencheng21 commented Feb 5, 2026

Description

Before the fix

image

After the fix

image

Summary by CodeRabbit

  • Bug Fixes
    • Improved app-based authentication to ensure tokens are properly refreshed during use, preventing potential authentication failures due to token expiration.

@Bencheng21 Bencheng21 requested a review from a team February 5, 2026 19:57
@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

Walkthrough

Refactors JWT token sourcing in the connector by introducing a reusable token source and app JWT token refresher. The installation token flow now derives from refreshed app JWT tokens instead of one-shot tokens, with appClient overridden to use the shared jwtts token source.

Changes

Cohort / File(s) Summary
JWT Token Source Refactoring
pkg/connector/connector.go
Introduces reusable jwtts token source with app JWT token refresher. Replaces inline token source in jwtTokenSource and overrides appClient to use jwtts, aligning app-based authentication with token refresh mechanics.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A token once rigid, now fluid and free,
Through refresh mechanics, a harmony!
The app JWT dances with sources anew,
Installation flows blessed with a better view! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing a static token with a reusable token source in appClient, which aligns with the AI-generated summary of introducing jwtts and overriding appClient.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ben/refresh_jwttoken

Comment @coderabbitai help to get the list of available commands and usage tips.

appClient, err = newGitHubClient(ctx,
ghc.InstanceUrl,
jwtts,
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like line 305 - 344 is unnecessary, but need to investigate why it's there.

@Bencheng21 Bencheng21 merged commit bc9c6af into main Feb 6, 2026
8 of 9 checks passed
@Bencheng21 Bencheng21 deleted the ben/refresh_jwttoken branch February 6, 2026 00:36
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.

3 participants