/iblai-vibe:iblai-api-studio-authfrom ibl.ai vibe
Authenticates with Open edX Studio and LMS via browser-based session login, capturing cookies into a gitignored env file. Run before any other Studio skill; includes --check to validate existing sessions.
Ships in ibl.ai vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Studio (the Open edX CMS) has no token API for authoring: every authoring
endpoint is guarded by a Django session cookie + CSRF token. This skill
captures that session from a browser the user signs into, verifies it against
Studio and the LMS (the LMS side shares the same login), and stores it
in studio.env. Run it once per host; sessions last about two weeks.
node .claude/skills/iblai-api-studio-auth/scripts/studio-login.mjs --check && grep -q '^STUDIO_ORG=.\+' studio.env && echo "STUDIO_ORG set" || echo "MISSING: run /iblai-api-studio-auth and set STUDIO_ORG in studio.env"
--check prints studio: ok · lms: ok and exits 0 when both sessions work,
exits 2 when the file is missing or a session expired. Every other
/iblai-api-studio-* skill starts with this line; when it fails, come back
here instead of retrying calls.
| Key | Value | Used by |
|---|---|---|
STUDIO_URL | https://studio.learn.iblai.app (default) — test server https://studio.learn.iblai.org | every /iblai-api-studio-* skill |
LMS_URL | https://learn.iblai.app (derived: strip studio.) | /iblai-api-studio-lms, verification links |
LMS_APP_URL | https://lms.ibl.ai (test: https://lms.iblai.org) — the app users open | course URLs in reports |
STUDIO_ORG | org key used as the org when creating courses (set by hand once; the script preserves it) | /iblai-api-studio-course-create |
STUDIO_USERNAME | the signed-in username (read from GET $LMS_URL/api/user/v1/me) | LMS calls that need username |
STUDIO_SESSION / STUDIO_CSRF | Studio cookies studio_session_id / csrftoken | Studio -b cookie + X-CSRFToken |
LMS_SESSION / LMS_CSRF | LMS cookies sessionid / csrftoken | LMS -b cookie + X-CSRFToken |
STUDIO_SESSION_EXPIRES | cookie expiry (ISO) | "is it still valid?" without a request |
The file is chmod 600 and the script adds it to .gitignore. Never print a
session value — the script prints **** + last four only.
Session values are single-quoted because Django session ids contain |
and :. set -a; . ./studio.env; set +a strips the quotes; a naive parser
does not, and Studio answers a malformed cookie with HTTP 500 and an HTML
"Studio Server Error" page, not 401/403. Strip them:
import re
env = {m[1]: m[2].strip().strip("'") for m in (re.match(r"^([A-Z_]+)=(.*)$", l) for l in open("studio.env")) if m}
const env = Object.fromEntries([...fs.readFileSync("studio.env","utf8").matchAll(/^([A-Z_]+)=(.*)$/gm)].map(([,k,v]) => [k, v.trim().replace(/^'(.*)'$/, "$1")]));
Sanity check: len(env["STUDIO_SESSION"]) is the cookie length (typically 187), with no quote characters.
Run the capture script from the project directory (needs Node 18+; uses
Google Chrome / Edge if installed, else Playwright's Chromium; installs
playwright-core into ~/.cache/iblai-studio/ once if no Playwright is
resolvable — no browser download):
node .claude/skills/iblai-api-studio-auth/scripts/studio-login.mjs # production
node .claude/skills/iblai-api-studio-auth/scripts/studio-login.mjs --studio https://studio.learn.iblai.org # test server
A browser window opens on $STUDIO_URL/home. Tell the user to sign in
there themselves (Studio redirects to the LMS login, then back). Never type
credentials for them. The script polls once a second for the
studio_session_id + sessionid cookies, verifies both, writes the file,
closes the browser, and prints one line:
connected: studio.learn.iblai.app as <username> · session ****ab12 · expires 2026-09-28 → /path/studio.env
Flags: --out <file> (default ./studio.env), --lms <url>, --lms-app <url>,
--profile <dir> (browser profile, default ~/.cache/iblai-studio/profile-<host>
— re-runs skip the login while the browser session lasts), --timeout <s>
(default 300). Exit 1 = timed out waiting for a sign-in.
Set the org key (once): STUDIO_ORG=<org key> in studio.env. Course
creation needs the key of the organization the user authors in (the path
segment after /platform/ on os.ibl.ai, or PLATFORM in iblai.env). If
you do not know it, list the user's roles — org-instructor rows carry it:
set -a; . ./studio.env; set +a
curl -s -b "studio_session_id=$STUDIO_SESSION; csrftoken=$STUDIO_CSRF" -H "Accept: application/json" \
"$STUDIO_URL/api/ibl/users/manage/roles/?username=$STUDIO_USERNAME" # [{"role":"org-instructor","org":"acme","course":""}, …]
Verify with the preflight line above.
Have the user copy the cookies from DevTools (Application → Cookies) on a
signed-in Studio tab: studio_session_id, csrftoken; and on a signed-in LMS
tab: sessionid. Write studio.env yourself with the keys above (single-quote
the values), chmod 600, add it to .gitignore, then run --check. Ask for
cookies in a file or env var, never pasted into the chat when avoidable.
set -a; . ./studio.env; set +a
S=(-s -b "studio_session_id=$STUDIO_SESSION; csrftoken=$STUDIO_CSRF" -H "X-CSRFToken: $STUDIO_CSRF" \
-H "Origin: $STUDIO_URL" -H "Referer: $STUDIO_URL/" -H "Accept: application/json" -H "Content-Type: application/json")
curl "${S[@]}" "$STUDIO_URL/api/contentstore/v2/home/courses"
Accept: application/json is mandatory — the same URLs return HTML pages without it.X-CSRFToken + Origin/Referer on the Studio origin are required on every
POST/PUT/PATCH/DELETE (Django CSRF checks Origin on HTTPS).-b "sessionid=$LMS_SESSION; csrftoken=$LMS_CSRF" -H "X-CSRFToken: $LMS_CSRF" -H "Origin: $LMS_URL" -H "Referer: $LMS_URL/".| You see | It means | Do |
|---|---|---|
302 → /login/… (Studio), 401 (LMS API) | session expired or missing | re-run step 1 |
403 mentioning CSRF | X-CSRFToken/Origin missing or stale csrftoken | resend with the snippet; re-run step 1 if it persists |
403 {"error":"Permission denied"} / "You do not have permission…" | signed in, but not staff/instructor on that org or course | /iblai-api-studio-team, /iblai-api-management |
500 + HTML "Studio Server Error" on a documented call | almost always a malformed cookie (quotes, truncation, wrong file) — or a parameter the skill flags as broken | run --check; compare cookie length; re-read the skill's notes |
HTML page instead of JSON with 200 | missing Accept: application/json | add the header |
studio.env = one host. Switching between production and the test server
means re-running with --studio (or keeping two files and --out).~/.cache/iblai-studio/ holds the browser's own cookies — delete it to
force a fresh login./login/edx-oauth2/ → LMS login → /complete/edx-oauth2/), which is why
the LMS sessionid is always available too and why both are captured./iblai-api-management
(Api-Token); for catalog and enrollment data use /iblai-api-catalog./iblai-api-studio.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub iblai/base --plugin iblai-vibe166 skills in this plugin
/iblai-api-agent-accessManage role-based access to an ibl.ai agent via the platform API — list role policies, search users/groups, and grant/revoke editor, chat, or analytics_viewer roles for users, groups, and emails. Use when controlling who can edit, chat with, or view analytics for an agent./iblai-api-agent-auditRead an ibl.ai agent's audit log via the platform API — a who-changed-what trail filterable by action, actor email, and date range. Read-only. Use when investigating configuration changes to an agent./iblai-api-agent-chatSet up live chat with a deployed ibl.ai agent by wiring the hosted iblai-api-agent-chat MCP server into the project (.mcp.json / claude mcp add) using the .env Api-Token and a chosen agent's unique id, or by signing in from claude.ai, ChatGPT or Claude Desktop with only the URL. Use to enable runtime conversations with an agent, and to list or disconnect the apps a user has connected. The actual chatting then happens through the MCP server's tools.Other plugins' skills for the same job