MCPcopy Create free account
hub / github.com/cli/cli / NewTokenRefresher

Function NewTokenRefresher

internal/authflow/refresh.go:33–39  ·  view source on GitHub ↗

NewTokenRefresher builds a TokenRefresher that renews credentials issued to gh's OAuth app. The provided HTTP client should be a plain client that sets no auth or other headers, since the token endpoint is reached without an existing token.

(httpClient *http.Client)

Source from the content-addressed store, hash-verified

31// should be a plain client that sets no auth or other headers, since the token endpoint is reached without an existing
32// token.
33func NewTokenRefresher(httpClient *http.Client) *TokenRefresher {
34 return &TokenRefresher{
35 httpClient: httpClient,
36 clientID: oauthClientID,
37 clientSecret: oauthClientSecret,
38 }
39}
40
41// Refresh exchanges refreshToken for a renewed credential on hostname. A refresh token the server rejects surfaces as
42// an error wrapping gh.ErrRefreshTokenInvalid, so callers can distinguish an unusable refresh token from a transient

Calls

no outgoing calls