Skip to content

Credential protocol enhancement: OAuth token expiration and refresh tokens #2059

Open

Description

@dscho

Starting in Git 2.40, the protocol learned a few new keys including around storing and retrieving an OAuth token's expiration date. This will be helpful to support such that tokens stored in credential stores can be used or discarded without an extra network call to determine if they are still within the validity period. 

Likewise, the protocol from v2.41 now includes an optional OAuth refresh token key that allows helpers to more easily communicate both an access and refresh token as part of a get + store/erase request and response pair. Today, host providers have had to preemptively store the refresh token manually, in a separate credential store entry, even if the incorrect user account was selected.

Author: @mjcheetham

Activity

  1. crablab commented on Oct 4, 2025

    @crablab

    It's probably worth nothing the lack of support here does lead to problems with Forgjeo instances: https://codeberg.org/forgejo/forgejo/issues/2809

  2. becm commented on Oct 11, 2025

    @becm
    Contributor

    @crablab just making the data available will not help without further code.
    To have notable effect, using a multi-step auth schema (#2057) would be needed (and triggered) on expired items.

    Expiry check (#268) with internal refresh (#1837) is a more primitivecontained solution to this issue. ☺

  3. becm commented on Oct 11, 2025

    @becm
    Contributor

    @dscho putting the refresh_token on the wire may have security drawbacks:

    • any process can (technically) ask for an access_token
    • it gets the (much more critical) refresh_token "for free"
    • in many scenarios, this is enough to maliciously invalidate the OAuth client registration.

    If I'd have to choose; better to (proactively) refresh the requested access_token internally on detected expiry.
    (And maybe even think of ways to better secure the refresh_token as a private GCM secret).

  4. mr-otmarg commented on Nov 6, 2025

    @mr-otmarg

    Similar topic #2003

  5. added
    gcm3.0Targets the next major release of Git Credential Manager - v3.0
    on Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgcm3.0Targets the next major release of Git Credential Manager - v3.0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions