TokenForUserWithRefresh retrieves the credential for a specified user and hostname and, when it is refreshable and its access token is expiring, renews and persists it, returning the credential to use and the refresh outcome. Non-refreshable credentials are returned unchanged with RefreshStatusInapp
(hostname, username string)
| 733 | // its access token is expiring, renews and persists it, returning the credential to use and the refresh outcome. |
| 734 | // Non-refreshable credentials are returned unchanged with RefreshStatusInapplicable. |
| 735 | func (c *AuthConfig) TokenForUserWithRefresh(hostname, username string) (gh.Credential, gh.RefreshStatus, error) { |
| 736 | credential, err := c.TokenForUser(hostname, username) |
| 737 | if err != nil { |
| 738 | return credential, gh.RefreshStatusInapplicable, err |
| 739 | } |
| 740 | if !credential.IsRefreshable() { |
| 741 | return credential, gh.RefreshStatusInapplicable, nil |
| 742 | } |
| 743 | return c.refreshCredentialForUser(hostname, username, credential) |
| 744 | } |
| 745 | |
| 746 | func keyringServiceName(hostname string) string { |
| 747 | return "gh:" + hostname |
nothing calls this directly
no test coverage detected