Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(generic): check local token expiry#1837

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
becm wants to merge1 commit intogit-ecosystem:main
base:main
Choose a base branch
Loading
frombecm:oauth-refresh-token

Conversation

@becm
Copy link
Contributor

@becmbecm commentedFeb 13, 2025
edited
Loading

Not checking for expired tokens triggers failures on first fetch/push after expiration.
Many Oauth2 implementations use JWT, where expiration time stamp is stored in structured data.

Fixes#268
Fixes#1408
Fixes#1784

StephenBrough, remyroy, Speedy37, marvint24, FedericoQuin, Rosy-iso, lunny, lostmsu, w3ori, kapipapi, and 4 more reacted with thumbs up emojiFerr123321 reacted with laugh emoji
@becmbecm changed the titlefix(generic): save new refresh_token valuefix(generic): refresh of local tokensFeb 14, 2025
@becm
Copy link
ContributorAuthor

becm commentedFeb 15, 2025
edited
Loading

I'd very much like to haveany approach towards identifying local token expiration.
Alternative idea:

  • the username is (for the generic provider, at the moment) basically unused (fixed value).
  • we can change the stored value toOAUTH_USER@<expiration>.

The last approach changing the API for the storage format (#1464) is now stale for almost a year.
Neither suggestions here would need additional code to be touched.

Theusername approach is likely evenwaaayyy more compact.
For fully transparent handling of Git credential flow usingstore, thefull username must be retained for theauth_token credential.
Due to limitations of Git using a BasicAuth header, a colon isnot a valid separator.

@becmbecm changed the titlefix(generic): refresh of local tokensfix(generic): check local token expiryFeb 15, 2025
@becm
Copy link
ContributorAuthor

becm commentedFeb 16, 2025
edited
Loading

Some major caveat found while trying to prototype a "username@expiration" approach:
API mayonly returnexpires_in for the newaccess_token, not an updaterefresh_token!

Some storage back ends may also be thrown off by the changing username…

Relative time in protocol additionally indicates this is to be used as a transient element.
Committing that value to permanent storage (after calculating an absolute date) feels like a data flow violation.

For now I'd definitely favor using structured token detection (transparent, backward-compatible, non-intrusive).

@lostmsu
Copy link

@mjcheetham@mpysson can you please take a look at this change? It's already been iterated upon.

@lostmsu
Copy link

@mjcheetham@mpysson there've been no changes in this project for 5 months. Can I co-maintain it? Not sure if I can do it long term but I promise to go through the currently open pull requests at the very least. Better than nothing.

Heap0017, pnufm5qz, 4wincode, Speedy37, and ravzkie12 reacted with heart emoji

@itsjustnickdev
Copy link

any updates on this push?

@dscho
Copy link
Contributor

any updates on this push?

@itsjustnickdev cautiously: yes. I opened#2059.

However, during the extended time of ownership limbo, Git Credential Manager's release process has withered to the point where no releases can be made as of time of writing (notarizing, for example, is broken, yet it is required for Git Credential Manager to work on macOS).

Therefore, the primary concern right now is to get that release process into a healthy shape.

If you want to look into#2059 in the meantime, that would be really cool, of course!

Copy link
Contributor

@mjcheethammjcheetham left a comment

Choose a reason for hiding this comment

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

What do you think about the merits of using theJsonWebToken type from thehttps://www.nuget.org/packages/Microsoft.IdentityModel.JsonWebTokens package?

add decode support to Base64Url converteroverride GenericHostProvider credential query to check for token expiryadd expiry check for refresh tokenadd generic StructuredToken class with expiry status propertyadd minimal JWT data classes for content decoding and extraction
@becmbecm requested a review froma team as acode ownerNovember 14, 2025 15:39
@becm
Copy link
ContributorAuthor

@mjcheetham replaced handling of JWT with ageneric StructuredToken placeholder.

This should make expanding support (or replace implementation) fairly easily later on.
Kept theminimalist JWT extraction approach (fancy 3-liner plus boilerplate) for now.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mjcheethammjcheethammjcheetham left review comments

+1 more reviewer

@hickfordhickfordhickford approved these changes

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

6 participants

@becm@lostmsu@itsjustnickdev@dscho@hickford@mjcheetham

[8]ページ先頭

©2009-2025 Movatter.jp