(ctx context.Context, code string)
| 981 | } |
| 982 | |
| 983 | func (s *Server) userAuthGithubClient(ctx context.Context, code string) (*github.Client, *admin.GithubToken, error) { |
| 984 | oauthConf := &oauth2.Config{ |
| 985 | ClientID: s.opts.GithubClientID, |
| 986 | ClientSecret: s.opts.GithubClientSecret, |
| 987 | Endpoint: githuboauth.Endpoint, |
| 988 | } |
| 989 | |
| 990 | token, err := oauthConf.Exchange(ctx, code) |
| 991 | if err != nil { |
| 992 | return nil, nil, err |
| 993 | } |
| 994 | |
| 995 | oauthClient := oauthConf.Client(ctx, token) |
| 996 | return github.NewClient(oauthClient), &admin.GithubToken{AccessToken: token.AccessToken, Expiry: token.Expiry, RefreshToken: token.RefreshToken}, nil |
| 997 | } |
| 998 | |
| 999 | // isCollaborator checks if the user is a collaborator of the repository identified by owner and repo |
| 1000 | // client must be authorized with user's auth token |
no test coverage detected