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)
| 31 | // should be a plain client that sets no auth or other headers, since the token endpoint is reached without an existing |
| 32 | // token. |
| 33 | func 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 |
no outgoing calls