Skip to content

API proposal: Expose AuthenticationSession access token lifetime #335184

Description

@TylerLeonhardt

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.
  • undefined means 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.

Activity

  1. added this to the 1.138.0 milestone on Sep 9, 2026
  2. added
    feature-request
    authentication
    authentication-github
    copilot-cli-agent
    agent-host
    on Sep 9, 2026
  3. added
    unreleased
    insiders-released
    verification-needed
    and removed
    unreleased
    on Sep 11, 2026
  4. modified the milestones: 1.141.0, Backlog on Oct 1, 2026
  5. removed
    insiders-released
    on Oct 1, 2026
  6. removed
    verification-needed
    on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agent-hostapiapi-finalizationapi-proposalauthenticationauthentication-githubcopilot-cli-agentfeature-request

Type

No type

Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions