Skip to content

authentication: Express token expiry in milliseconds - #335610

Merged
TylerLeonhardt merged 2 commits into
mainfrom
tyleonha/github-auth-expires-after
Sep 11, 2026
Merged

TylerLeonhardt merged 2 commits into
mainfrom
tyleonha/github-auth-expires-after

Conversation

@TylerLeonhardt

@TylerLeonhardt TylerLeonhardt commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Summary

  • rename the proposed authentication session lifetime from expiresIn to expiresAfter and define it as milliseconds
  • convert GitHub OAuth expires_in values at the provider boundary and recompute remaining lifetimes for cached transient sessions
  • preserve the Agent Host protocol's seconds-based expiresIn field by converting at the workbench bridge
  • expose MSAL token expiration from the built-in Microsoft Authentication extension

Closes #335184.

Related to #152517.

Testing

  • npm --prefix extensions\github-authentication run compile
  • npm --prefix extensions\microsoft-authentication run compile
  • ESLint on all eight changed TypeScript files
  • GitHub Authentication extension-host tests: 25 passing
  • Agent Host authentication unit tests: 2 passing
  • interactive Code OSS Microsoft sign-in with dap-cli: verified MSAL expiresOn becomes a positive integer millisecond AuthenticationSession.expiresAfter value and flows through the returned session
  • git diff --check origin/main...HEAD

A full npm run compile reached the changed extensions successfully but is currently blocked by unrelated markdown editor type errors involving IframeEmbeddedEditorHostTransport and iframeBootstrapUrl.

TylerLeonhardt and others added 2 commits September 10, 2026 18:18
Rename the token exchange duration to expiresAfter and convert OAuth seconds at the exchange boundary.

Co-authored-by: Copilot <[email protected]>
Expose MSAL's token expiration through the proposed authentication session expiration API as a positive millisecond duration.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 11, 2026 01:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The unit conversions, cached-session recomputation, protocol compatibility, and associated tests are internally consistent.

Review tier: Balanced
Findings: None

What changed in this PR

Updates authentication-session expiry semantics to use relative milliseconds while preserving the Agent Host protocol’s seconds-based contract.

Changes:

  • Renames expiresIn to expiresAfter and documents milliseconds.
  • Converts and recomputes GitHub and Microsoft token lifetimes.
  • Converts milliseconds back to seconds at the Agent Host bridge and updates tests.
File Description
src/​vscode-dts/​vscode.proposed.authSessionExpiration.d.ts Updates the proposed API contract.
src/​vs/​workbench/​services/​authentication/​common/​authentication.ts Updates the internal session model.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostAuth.ts Converts milliseconds to protocol seconds.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostAuth.test.ts Updates bridge conversion tests.
extensions/​microsoft-authentication/​package.json Enables the expiry proposal.
extensions/​microsoft-authentication/​tsconfig.json Includes the proposal declaration.
extensions/​microsoft-authentication/​src/​node/​authProvider.ts Exposes MSAL token lifetime.
extensions/​github-authentication/​src/​github.ts Stores and recomputes millisecond lifetimes.
extensions/​github-authentication/​src/​entraTokenExchange.ts Converts OAuth expiry seconds to milliseconds.
extensions/​github-authentication/​src/​test/​github.test.ts Updates provider lifetime tests.
extensions/​github-authentication/​src/​test/​entraTokenExchange.test.ts Updates exchange expectations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@TylerLeonhardt
TylerLeonhardt marked this pull request as ready for review September 11, 2026 01:46
@TylerLeonhardt
TylerLeonhardt enabled auto-merge (squash) September 11, 2026 01:46
@TylerLeonhardt TylerLeonhardt added this to the 1.139.0 milestone Sep 11, 2026
@TylerLeonhardt
TylerLeonhardt merged commit 62abd13 into main Sep 11, 2026
35 checks passed
@TylerLeonhardt
TylerLeonhardt deleted the tyleonha/github-auth-expires-after branch September 11, 2026 07:30
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Oct 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API proposal: Expose AuthenticationSession access token lifetime

3 participants