(ctx context.Context, link database.ExternalAuthLink)
| 636 | } |
| 637 | |
| 638 | func (c *Config) TokenRevocationRequestGitHub(ctx context.Context, link database.ExternalAuthLink) (*http.Request, error) { |
| 639 | // GitHub doesn't follow RFC spec |
| 640 | // https://docs.github.com/en/rest/apps/oauth-applications?apiVersion=2022-11-28#delete-an-app-authorization |
| 641 | body := fmt.Sprintf("{\"access_token\":%q}", link.OAuthAccessToken) |
| 642 | req, err := http.NewRequestWithContext(ctx, http.MethodDelete, c.RevokeURL, strings.NewReader(body)) |
| 643 | if err != nil { |
| 644 | return nil, err |
| 645 | } |
| 646 | req.Header.Add("Accept", "application/vnd.github+json") |
| 647 | req.Header.Add("X-GitHub-Api-Version", "2022-11-28") |
| 648 | req.SetBasicAuth(c.ClientID, c.ClientSecret) |
| 649 | return req, nil |
| 650 | } |
| 651 | |
| 652 | func (c *Config) TokenRevocationResponseOk(res *http.Response) bool { |
| 653 | // RFC spec on successful revocation returns 200, GitHub 204 |
no test coverage detected