MCPcopy Index your code
hub / github.com/rilldata/rill / userAuthGithubClient

Method userAuthGithubClient

admin/server/github.go:983–997  ·  view source on GitHub ↗
(ctx context.Context, code string)

Source from the content-addressed store, hash-verified

981}
982
983func (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

Callers 2

githubConnectCallbackMethod · 0.95
githubAuthCallbackMethod · 0.95

Calls 2

NewClientMethod · 0.80
ClientMethod · 0.45

Tested by

no test coverage detected