MCPcopy
hub / github.com/docker/docker-agent / PromptOAuthAuthorization

Method PromptOAuthAuthorization

pkg/cli/printer.go:180–203  ·  view source on GitHub ↗

PromptOAuthAuthorization prompts the user for OAuth authorization

(ctx context.Context, serverURL string)

Source from the content-addressed store, hash-verified

178
179// PromptOAuthAuthorization prompts the user for OAuth authorization
180func (p *Printer) PromptOAuthAuthorization(ctx context.Context, serverURL string) ConfirmationResult {
181 p.Println("\n🔐 OAuth Authorization Required")
182 p.Println("Server:", serverURL, "(remote)")
183 p.Println("This server requires OAuth authentication to access its tools.")
184 p.Println("Your browser will open automatically to complete the authorization.")
185 p.Printf("\n%s (y/n): ", "Do you want to authorize access?")
186
187 response, err := input.ReadLine(ctx, os.Stdin)
188 if err != nil {
189 p.Println("\nFailed to read input, aborting authorization...")
190 return ConfirmationAbort
191 }
192
193 response = strings.TrimSpace(strings.ToLower(response))
194 if response == "y" || response == "yes" {
195 p.Println("✓ Starting OAuth authorization...")
196 p.Println("Please complete the authorization in your browser.")
197 p.Print("Once completed, the agent will continue automatically.\n\n")
198 return ConfirmationApprove
199 } else {
200 p.Print("Authorization declined. Exiting...\n\n")
201 return ConfirmationReject
202 }
203}
204
205func formatToolCallArguments(arguments string) string {
206 if arguments == "" {

Callers 1

RunFunction · 0.80

Calls 4

PrintlnMethod · 0.95
PrintfMethod · 0.95
PrintMethod · 0.95
ReadLineFunction · 0.92

Tested by

no test coverage detected