-
Notifications
You must be signed in to change notification settings - Fork 5.3k
servers: Don't use an auth token that expires within 1 second. #16459
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis update introduces a minor enhancement to the server-side OAuth token refresh logic within the SDK. The logic now triggers a token refresh if the token is set to expire within the next second, rather than waiting for it to fully expire. The changelog and package version have been updated to reflect this change, with no modifications to public APIs or exported entities. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ServerSDK
participant OAuthProvider
Client->>ServerSDK: Make authorized request
alt Token expires in >1s
ServerSDK-->Client: Use existing token
else Token expires in <=1s
ServerSDK->>OAuthProvider: Refresh token
OAuthProvider-->>ServerSDK: New token
ServerSDK-->Client: Use refreshed token
end
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
packages/sdk/CHANGELOG.md
(1 hunks)packages/sdk/package.json
(1 hunks)packages/sdk/src/server/index.ts
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: test
packages/sdk/CHANGELOG.md
[failure] 9-9: Line length
packages/sdk/CHANGELOG.md:9:81 MD013/line-length Line length [Expected: 80; Actual: 98] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
🪛 GitHub Actions: Lint SDK Markdown Files
packages/sdk/CHANGELOG.md
[error] 9-9: markdownlint MD013/line-length: Line length exceeds 80 characters (Actual: 98).
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: test
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
🔇 Additional comments (2)
packages/sdk/package.json (1)
4-4
: Version bump looks goodThe package version has been updated from 1.5.3 to 1.5.4, which is consistent with the changes in the CHANGELOG.md and the implementation.
packages/sdk/src/server/index.ts (1)
261-261
: Excellent proactive token refresh improvementThe change to refresh the OAuth token when it's about to expire within 1 second (rather than waiting until it actually expires) is a good defensive programming practice. This helps prevent potential authorization failures that could occur if a request is made with a token that expires during the request processing.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/sdk/CHANGELOG.md
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: test
packages/sdk/CHANGELOG.md
[failure] 9-9: Trailing spaces
packages/sdk/CHANGELOG.md:9:82 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md009.md
[failure] 9-9: Line length
packages/sdk/CHANGELOG.md:9:81 MD013/line-length Line length [Expected: 80; Actual: 82] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
[failure] 10-10: Lists should be surrounded by blank lines
packages/sdk/CHANGELOG.md:10 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "within 1 second."] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md032.md
🪛 GitHub Actions: Lint SDK Markdown Files
packages/sdk/CHANGELOG.md
[error] 9-9: markdownlint MD009/no-trailing-spaces: Trailing spaces found (Expected: 0 or 2; Actual: 1). See https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md009.md
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Lint Code Base
- GitHub Check: test
- GitHub Check: pnpm publish
WHY
Summary by CodeRabbit
Bug Fixes
Documentation