MCPcopy Index your code
hub / github.com/github/github-mcp-server / joinWait

Method joinWait

internal/oauth/manager.go:280–300  ·  view source on GitHub ↗

joinWait blocks until the running flow finishes or ctx is cancelled. If the flow was promoted to the manual channel while waiting (its prompt could not be delivered), it returns that user action rather than an error.

(ctx context.Context, done chan struct{})

Source from the content-addressed store, hash-verified

278// flow was promoted to the manual channel while waiting (its prompt could not be
279// delivered), it returns that user action rather than an error.
280func (m *Manager) joinWait(ctx context.Context, done chan struct{}) (*Outcome, error) {
281 select {
282 case <-done:
283 if m.AccessToken() != "" {
284 return nil, nil
285 }
286 m.mu.Lock()
287 pending := m.pending
288 err := m.lastErr
289 m.mu.Unlock()
290 if pending != nil {
291 return &Outcome{UserAction: pending}, nil
292 }
293 if err != nil {
294 return nil, err
295 }
296 return nil, errors.New("authorization did not complete")
297 case <-ctx.Done():
298 return nil, ctx.Err()
299 }
300}
301
302func (m *Manager) oauth2Config(redirectURL string) *oauth2.Config {
303 return &oauth2.Config{

Callers 1

AuthenticateMethod · 0.95

Calls 1

AccessTokenMethod · 0.95

Tested by

no test coverage detected