getTokenReadOnly resolves the stored active token for the hostname and optional username without contacting the token endpoint. It still surfaces a refreshable credential's stored access token, so an expiring token is returned, just not refreshed.
(authCfg gh.AuthConfig, hostname, username string)
| 180 | // token endpoint. It still surfaces a refreshable credential's stored access token, so an expiring token is |
| 181 | // returned, just not refreshed. |
| 182 | func getTokenReadOnly(authCfg gh.AuthConfig, hostname, username string) gh.Credential { |
| 183 | if username == "" { |
| 184 | return authCfg.ActiveToken(hostname) |
| 185 | } |
| 186 | cred, _ := authCfg.TokenForUser(hostname, username) |
| 187 | return cred |
| 188 | } |
| 189 | |
| 190 | // getTokenWithRefresh resolves the active token for the hostname and optional username and refreshes it when |
| 191 | // necessary. Refresh is best effort: a failed refresh still yields the last stored token, and an empty result is |
no test coverage detected