-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relative expiration times #2125
Comments
I think this is a great call, I'm definitely for adding this to the API. I've been wondering this morning about how we should implement this in the client. I have a few thoughts:
type T struct {
// ...
ExpiresAt time.Time
ExpiresIn time.Duration
}
func (t *T) IsExpiredWithin(d time.Duration) bool { ... } Which would definitely work, I'm just not sure I like exposing both
package tools
func ParseExpiresAtOrIn(r io.Reader) (time.Duration, error) { ... } Which would work and simplifies the signature of both API types, but also introduces a new function and an additional parse step. At a broader scope, I like this change because we don't have to break existing APIs, and we can deprecate the |
|
I think in this case it'd be a reader that dispenses JSON, so that we could feed it to Either way, I'm fine with just adding a new property to each API's type. |
The Batch API and
git-lfs-authenticate
ssh call both can optionally return anexpires_at
marking when an authentication token expires. The client uses this hint to know if it should attempt the request, or get a fresh token. However, this causes problems for users with incorrect times.Proposal: Introduce
expires_in
, which returns the number of seconds the token is valid. This should take precedence over an existingexpires_at
property.The text was updated successfully, but these errors were encountered: