fetchTokenScopesForHost fetches the OAuth scopes for a token from the GitHub API. It constructs the appropriate API host URL based on the configured host.
(ctx context.Context, token, host string)
| 435 | // fetchTokenScopesForHost fetches the OAuth scopes for a token from the GitHub API. |
| 436 | // It constructs the appropriate API host URL based on the configured host. |
| 437 | func fetchTokenScopesForHost(ctx context.Context, token, host string) ([]string, error) { |
| 438 | apiHost, err := utils.NewAPIHost(host) |
| 439 | if err != nil { |
| 440 | return nil, fmt.Errorf("failed to parse API host: %w", err) |
| 441 | } |
| 442 | |
| 443 | fetcher := scopes.NewFetcher(apiHost, scopes.FetcherOptions{}) |
| 444 | |
| 445 | return fetcher.FetchTokenScopes(ctx, token) |
| 446 | } |
no test coverage detected