Use only this project's CLI to handle authentication:
python scripts/cli.py check-login
python scripts/cli.py login
Applicable Scenarios
- The user asks whether Xianyu is logged in.
- The user asks to log in to Xianyu or confirm the current account.
- The login status needs to be confirmed before other Xianyu operations.
Workflow
- First run
check-login。 - If it returns
logged_in: true, report the nickname, page URL, and title to the user. - If not logged in, run
loginto open the Xianyu page. - Have the user scan the QR code or complete web login in Chrome.
- After login is complete, run
check-login。
Output Interpretation
logged_in: whether it is recognized as logged in.nickname: the current Xianyu account nickname.url/title: the current page status, used to diagnose whether it is on the Xianyu page.
Boundaries
- Do not read, display, or export cookies or browser profiles.
- Do not ask the user to send sensitive information such as verification codes or passwords to the Agent.
get_cookiesbelongs to low-level diagnostic capabilities and is not used as regular authentication output.
Failure Handling
- Bridge connection failure: confirm that the Xianyu Bridge extension is loaded and connected to the local service.
- Still failing to recognize after login: refresh the Xianyu page and run
check-login。 - Chrome is not open: run
loginand wait for the browser to start; if necessary, have the user manually open Chrome.