Loading...
Loading...
Yida Platform Login State Management Skill, manages login state via Playwright (Cookie Persistence + QR Code Login) and retrieves CSRF Token.
npx skill4agent add openyida/yida-skills yida-loginpython3 .claude/skills/yida-login/scripts/login.py{"csrf_token":"b2a5d192-xxx","corp_id":"dingxxx","user_id":"1955225xxx","base_url":"https://abcd.aliwork.com"}python3 .claude/skills/yida-login/scripts/login.py --refresh-csrfpython3 .claude/skills/yida-login/scripts/login.pyloginUrlconfig.jsonabcd.aliwork.comcsrf_tokenbase_url.cache/cookies.json⚠️ Important:is obtained from the actual domain the browser redirects to after login, not thebase_urlorloginUrlconfigured indefaultBaseUrl. For example, even ifconfig.jsonis configured asloginUrl, if your account's organization corresponds tohttps://www.aliwork.com, the platform will automatically redirect, and the finalabcd.aliwork.comwill bebase_url. All subsequent API requests (includinghttps://abcd.aliwork.comreleases) will use thisyida-publish. To publish to a specific domain, ensure that thebase_urlinloginUrlpoints to the domain corresponding to that organization, and your account belongs to that organization.config.json
The project root directory is located by searching upward for theorconfig.jsondirectory..git
.cache/cookies.jsonbase_urlcsrf_tokentianshu_csrf_tokencorp_iduser_idtianshu_corp_usertianshu_csrf_tokenbase_urlpip install playwright && playwright install chromiumyida-login/
├── SKILL.md # This document
└── scripts/
└── login.py # Login script
Project Root Directory/
├── config.json # Global configuration (loginUrl, defaultBaseUrl)
└── .cache/
└── cookies.json # Login state cache (automatically generated at runtime, contains cookies + base_url){
"csrf_token": "b2a5d192-db90-484c-880f-9b48edd396d5",
"corp_id": "ding9a0954b4f9d9d40ef5bf40eda33b7ba0",
"user_id": "19552253733782",
"base_url": "https://abcd.aliwork.com",
"cookies": [...]
}is extracted from the value of the cookiecsrf_token;tianshu_csrf_tokenandcorp_idare extracted from the value of the cookieuser_id, which is in the formattianshu_corp_user, separated by the last{corpId}_{userId}._
is the actual domain the browser redirects to after login (e.g.,base_url), which may differ from thehttps://abcd.aliwork.cominloginUrl. Other scripts should use this value as the base address for API requests instead of hardcoding the domain.config.json
.cache/cookies.json{
"cookies": [...],
"base_url": "https://abcd.aliwork.com"
}csrf_tokencorp_iduser_idtianshu_csrf_tokentianshu_corp_userlogin.pyconfig.json{
"loginUrl": "https://www.aliwork.com/workPlatform",
"defaultBaseUrl": "https://www.aliwork.com"
}| Field | Description |
|---|---|
| QR code login page address (the platform may automatically redirect to another domain after successful login) |
| Default base address for API requests (only used as a fallback when |
errorCode| errorCode | Meaning | Handling Method |
|---|---|---|
| CSRF verification failed (csrf_token expired) | Call |
| Login state has expired (cookies invalid) | Call |
Note: Error judgment is based on thefield in the response body JSON, not the HTTP status code.errorCode
echo -n "" > .cache/cookies.jsonNote: The cookie cache file is located in thedirectory of the project root directory (the directory containing.cache/orREADME.md). Logging out does not affect deployed pages or saved data..git
yida-publishyida-create-appyida-create-pageyida-create-form-page