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

Method complete

internal/oauth/manager.go:251–275  ·  view source on GitHub ↗

complete records the flow result, installing a refreshing token source on success, and wakes any joined callers.

(tok *oauth2.Token, err error)

Source from the content-addressed store, hash-verified

249// complete records the flow result, installing a refreshing token source on
250// success, and wakes any joined callers.
251func (m *Manager) complete(tok *oauth2.Token, err error) {
252 m.mu.Lock()
253 defer m.mu.Unlock()
254
255 m.status = statusIdle
256 m.pending = nil
257 if err != nil {
258 m.lastErr = err
259 m.logger.Debug("oauth flow failed", "error", err)
260 } else {
261 m.lastErr = nil
262 // Config.TokenSource returns a ReuseTokenSource that refreshes expired
263 // tokens using the refresh token — this is what makes GitHub App
264 // (expiring) tokens work transparently. The refresh uses a bounded HTTP
265 // client so a stalled token endpoint can't block a tool call forever.
266 refreshCtx := context.WithValue(context.Background(), oauth2.HTTPClient, &http.Client{Timeout: tokenRefreshTimeout})
267 m.source = m.refreshConfig.TokenSource(refreshCtx, tok)
268 m.refreshErrLogged = false
269 m.logger.Info("github authorization complete")
270 }
271 if m.done != nil {
272 close(m.done)
273 m.done = nil
274 }
275}
276
277// joinWait blocks until the running flow finishes or ctx is cancelled. If the
278// flow was promoted to the manual channel while waiting (its prompt could not be

Callers 2

AuthenticateMethod · 0.95
runFlowMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected