MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / writeCLIHandoffPage

Method writeCLIHandoffPage

internal/auth/auth.go:246–259  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, user *identity.User, handoff *cliLoginHandoff)

Source from the content-addressed store, hash-verified

244}
245
246func (ua *UserAuth) writeCLIHandoffPage(w http.ResponseWriter, r *http.Request, user *identity.User, handoff *cliLoginHandoff) error {
247 key, err := ua.store.CreateAPIKey(r.Context(), user.ID, "CLI login", nil)
248 if err != nil {
249 return fmt.Errorf("failed to create api key: %w", err)
250 }
251
252 w.Header().Set("Content-Type", "text/html; charset=utf-8")
253 return cliLoginTemplate.Execute(w, map[string]string{
254 "CallbackURL": handoff.CallbackURL,
255 "State": handoff.State,
256 "APIKey": key.PlaintextKey,
257 "AgentEmail": ua.defaultAgentEmail(r.Context(), user.ID),
258 })
259}
260
261// HandleLogin redirects the user to Google OAuth.
262// CLI login params (cli_callback, cli_state) are encoded into the OAuth state

Callers 1

HandleCallbackMethod · 0.95

Calls 2

defaultAgentEmailMethod · 0.95
CreateAPIKeyMethod · 0.80

Tested by

no test coverage detected