| name | elearning-login |
| description | Use when tasks involve elearning.fudan.edu.cn, course APIs, assignment download/submission, or any operation that needs an authenticated Fudan Elearning session. Always run the login flow first and only continue after obtaining a valid session. |
Fudan Elearning Login Skill
Scope and priority
This skill is self-contained and does not rely on repository AGENTS.md.
If AGENTS.md is missing, this skill remains the single source of truth for Elearning login and session setup.
Trigger
When the user request mentions any of the following, this skill must be activated:
elearning
elearning.fudan.edu.cn
- 课程平台、课程列表、作业下载、作业提交
- Canvas API endpoints under
https://elearning.fudan.edu.cn/api/v1/...
Before any downstream Elearning action, run this skill first and establish authenticated session cookies.
Required environment
Set credentials in .env (flexible key names supported):
uis:你的学号
psw:你的密码
If no .env file is available, the login script can also read system
environment variables. Preferred system environment variable names:
uis=你的学号
uis_psw=你的密码
Also supported (case-insensitive, punctuation-insensitive):
- Username keys:
uis, FUDAN_USERNAME, STUDENT_ID, STU_ID, LOGIN_NAME, ACCOUNT, ELEARNING_USERNAME, CAS_USERNAME, USERNAME
- Password keys:
uis_psw, psw, FUDAN_PASSWORD, PASSWORD, PASSWD, PWD, ELEARNING_PASSWORD, CAS_PASSWORD
The built-in script can read:
- standard dotenv format:
KEY=VALUE
- loose format:
KEY : VALUE
- optional
export KEY=VALUE
- keyless two-line format:
- line 1 = username
- line 2 = password
Python dependencies:
pip install requests pycryptodome
Mandatory workflow
-
Get lck
GET https://id.fudan.edu.cn/authserver/login?service=<urlencoded_service>
Extract from redirected URL with regex lck=([^&]+).
-
Get chainCode
POST https://id.fudan.edu.cn/idp/authn/queryAuthMethods
JSON:
{
"lck": "<step1_lck>",
"entityId": "https://elearning.fudan.edu.cn"
}
Extract: response.json()["data"][0]["chainCode"].
-
Get RSA public key
POST https://id.fudan.edu.cn/idp/authn/getJsPublicKey with {} JSON body.
Extract Base64 key from response.json()["data"].
-
Encrypt password + get loginToken
Use RSA key + PKCS1_v1_5 to encrypt plaintext password, then Base64-encode.
POST https://id.fudan.edu.cn/idp/authn/authExecute
JSON payload must keep credentials under authPara:
{
"authModuleCode": "userAndPwd",
"authChainCode": "<step2_chainCode>",
"entityId": "https://elearning.fudan.edu.cn",
"requestType": "chain_type",
"lck": "<step1_lck>",
"authPara"
Execution (no repository dependency)
Preferred:
python "$CODEX_HOME/skills/elearning-login/scripts/fudan_elearning_login.py"
With explicit env file path:
python "$CODEX_HOME/skills/elearning-login/scripts/fudan_elearning_login.py" --env-file /path/to/.env
Failure handling (must report precisely)
If login fails, report exact failed stage:
lck extraction failed
chainCode fetch failed
- RSA key fetch failed
loginToken missing
- ticket URL extraction failed
- final
JSESSIONID / token missing
Do not continue downstream elearning actions before login succeeds.
Non-AGENTS.md usage note
If repository AGENTS.md does not exist:
- Keep using this skill as the only login contract.
- Mention
elearning (or elearning.fudan.edu.cn) in user requests so the task clearly matches this skill.
- For explicit invocation, user can say:
Use elearning-login skill.