Skip to content

Bug: CLI login listener terminates prematurely on non-callback requests #59

Description

@Tanishkkkkk

Summary

The local CLI authentication HTTP server calls server.handle_request() only once. If the browser makes a request (like requesting /favicon.ico or sending a preflight request) before the token callback request is received, the server exits and the login fails.

Steps to Reproduce

  1. Run clutch login.
  2. Wait for the browser to open and authorize.
  3. If the browser requests /favicon.ico or any background resource before the token callback, observe the CLI exiting with "Login failed — no token received".

Expected vs Actual

  • Expected: The CLI server listens and handles requests until the token callback is successfully received.
  • Actual: The CLI server terminates after processing the first request, even if it is not the authentication callback.

Screenshot

No screenshot available (CLI state/login logic bug).

Suggested Fix

Wrap server.handle_request() in a loop inside cli/clutch_cli/authentication/login.py that continues until _captured_token contains the token value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions