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)
| 782 | // its access token is expiring, renews and persists it, returning the credential to use and the refresh outcome. |
| 783 | // Non-refreshable credentials are returned unchanged with RefreshStatusInapplicable. |
| 784 | func (c *AuthConfig) TokenForUserWithRefresh(hostname, username string) (gh.Credential, gh.RefreshStatus, error) { |
| 785 | credential, err := c.TokenForUser(hostname, username) |
| 786 | if err != nil { |
| 787 | return credential, gh.RefreshStatusInapplicable, err |
| 788 | } |
| 789 | if !credential.IsRefreshable() { |
| 790 | return credential, gh.RefreshStatusInapplicable, nil |
| 791 | } |
| 792 | return c.refreshCredentialForUser(hostname, username, credential) |
| 793 | } |
| 794 | |
| 795 | func keyringServiceName(hostname string) string { |
| 796 | return "gh:" + hostname |
nothing calls this directly
no test coverage detected