Repository navigation
Open
Labels
agent-hostIssues for the agent-host implementation (not the protocol)apiapi-finalizationapi-proposalauthenticationIssues with the Authentication platformauthentication-githubIssues with the GitHub Authentication extensioncopilot-cli-agentBackground Agent related features/bugsfeature-requestRequest for new features or functionality
Milestone
Description
Problem
AuthenticationSession exposes an access token but not its lifetime. Consumers that integrate with SDKs supporting renewable credentials cannot tell whether a token is static or when it should be refreshed.
#152517 previously proposed exposing an absolute expiresAt timestamp. An absolute timestamp is unsafe across VS Code's client/remote extension-host boundary because the two machines may have clock skew.
Proposed API
export interface AuthenticationSession {
/**
* The access token's remaining lifetime, in milliseconds, when the authentication provider returns the session.
*
* This corresponds to `expires_in` in an OAuth 2.0 token response, converted from seconds to
* milliseconds. Providers returning cached sessions must recompute this value. This is undefined
* when the authentication provider does not know the access token's expiry. When defined, this
* must be a positive integer.
*/
readonly expiresAfter?: number;
}Semantics
- The value is a positive integer representing whole milliseconds remaining when the session is returned.
- Cached sessions recompute the value on every return.
undefinedmeans the provider does not know the token's expiry.- The relative lifetime avoids comparing clocks across extension-host boundaries.
Implementation
The proposal lives in vscode.proposed.authSessionExpiration.d.ts. #334418 added it as expiresIn in seconds, and #335610 renamed it to expiresAfter in milliseconds. The GitHub Authentication extension reports it for Entra-brokered sessions, and the Microsoft Authentication extension reports MSAL token expiry.
Related to #152517.
Metadata
Metadata
Assignees
Labels
agent-hostIssues for the agent-host implementation (not the protocol)apiapi-finalizationapi-proposalauthenticationIssues with the Authentication platformauthentication-githubIssues with the GitHub Authentication extensioncopilot-cli-agentBackground Agent related features/bugsfeature-requestRequest for new features or functionality
Type
Projects
- StatusShow more project fieldsDone
Activity
AuthenticationSession#152517 as a duplicate of this issue