MCPcopy Index your code
hub / github.com/bytebase/bytebase / getTokenRefresher

Function getTokenRefresher

action/command/api.go:159–175  ·  view source on GitHub ↗
(httpClient connect.HTTPClient, email, password, url string)

Source from the content-addressed store, hash-verified

157}
158
159func getTokenRefresher(httpClient connect.HTTPClient, email, password, url string) func(ctx context.Context) (string, error) {
160 // Create a separate auth client without interceptors to avoid circular dependencies
161 authClient := v1connect.NewAuthServiceClient(httpClient, url)
162 return func(ctx context.Context) (string, error) {
163 req := connect.NewRequest(&v1pb.LoginRequest{
164 Email: email,
165 Password: password,
166 })
167
168 resp, err := authClient.Login(ctx, req)
169 if err != nil {
170 return "", errors.Wrapf(err, "failed to login")
171 }
172
173 return resp.Msg.Token, nil
174 }
175}
176
177func (c *client) checkRelease(ctx context.Context, r *v1pb.CheckReleaseRequest) (*v1pb.CheckReleaseResponse, error) {
178 resp, err := c.releaseClient.CheckRelease(ctx, connect.NewRequest(r))

Callers 2

newClientFunction · 0.85

Calls 2

LoginMethod · 0.95
NewAuthServiceClientFunction · 0.92

Tested by 1