Skip to content

feat: add browser-based one-click login#17

Open
echowxsy wants to merge 1 commit intocv-cat:masterfrom
echowxsy:feat/browser-login
Open

feat: add browser-based one-click login#17
echowxsy wants to merge 1 commit intocv-cat:masterfrom
echowxsy:feat/browser-login

Conversation

@echowxsy
Copy link
Copy Markdown

Summary

Add automatic cookie capture via browser login, eliminating the need to manually extract and set LARK_COOKIE environment variable.

Features

  • Browser login — Opens Feishu login page in Chromium, captures session cookies after login
  • Cookie persistence — Saved to ~/.lark/msg/cookie.json for reuse across sessions
  • Auto-load — Auth layer automatically loads saved cookie when LARK_COOKIE env var is not set
  • CLI integration--login / --logout / --login-timeout arguments

Usage

# First time: login via browser
python main.py --login

# Run the agent (cookie auto-loaded)
python main.py

# Clear saved cookie
python main.py --logout

Changes

  • app/api/browser_login.py (new) — Playwright-based login with cookie capture and persistence
  • app/api/auth.py — Add is_authenticated() check, auto-load saved cookie as fallback
  • main.py — Add argparse with --login/--logout/--login-timeout flags
  • requirements.txt — Add playwright>=1.40.0 (optional dependency)
  • .env.example — Add comment about --login option

Test plan

  • python main.py --login opens browser and captures cookie after login
  • Cookie is saved to ~/.lark/msg/cookie.json
  • python main.py loads saved cookie automatically
  • python main.py --logout clears saved cookie
  • Running without cookie shows helpful error message
  • Still works with LARK_COOKIE env var (takes priority over saved file)

🤖 Generated with Claude Code

- Add playwright-based browser login that opens Feishu login page
  and automatically captures session cookies
- Cookie persisted to ~/.lark/msg/cookie.json for reuse
- Auth now auto-loads saved cookie when LARK_COOKIE env var is not set
- Add --login/--logout CLI arguments to main.py
- Add is_authenticated() check with helpful error message

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant