Refresh the Moodle session cookie by logging in via the browser tool. Handles Okta SSO with Number Challenge — the agent reads the challenge number and tells the user which number to tap in their Okta Verify app.
Use this skill whenever the Moodle plugin reports session_expired: true, or when the user asks to refresh or set up their Moodle session.
your-university.okta.com or login.microsoftonline.com). If the browser is on an unexpected domain when credentials are requested, stop and alert the user.The following values must be set in the plugin config:
moodle-cli.moodleUrl — e.g. https://moodle.example.edumoodle-cli.username — university emailmoodle-cli.password — university passwordOpen the browser tool and navigate to the Moodle URL from config (e.g. https://moodle.example.edu).
Take a snapshot to see the current state.
Moodle will redirect to Okta SSO. If you see the Okta login page:
After entering credentials, Okta will display a Number Challenge — a 2-digit number on screen that the user must select in their Okta Verify app on their phone.
Important: The user is accessing this machine via SSH and cannot see the browser screen.
Take a snapshot of the browser
Look for the challenge number — it appears prominently on the Okta verification page (typically a large 2-digit number like "47" or "23")
Tell the user the number by outputting a clear message, e.g.:
🔐 Okta verification required. Please open Okta Verify on your phone and tap the number {number}.
Wait for the user to confirm they have tapped the number, OR poll by taking snapshots every 5 seconds until the page navigates away from the Okta challenge screen
If Okta shows a "Trust this device for 14 days" or similar prompt after successful verification:
Take a snapshot to confirm you have moved on.
After Okta approval, the browser should redirect back to Moodle. Take a snapshot to confirm the Moodle dashboard is visible.
If the redirect doesn't happen within ~30 seconds of the user tapping the number, take a fresh snapshot and check for any error messages or additional prompts.
Using the browser tool's cookie access, read all cookies for the Moodle domain and find the one named MoodleSession.
If the browser tool supports it:
browser.getCookies({ domain: "moodle.example.edu" })
Look for: { name: "MoodleSession", value: "..." }
Run the following bash command to update the plugin config with the new session cookie value:
openclaw config set moodle-cli.moodleSession <SESSION_VALUE>
Replace <SESSION_VALUE> with the actual cookie value extracted in step 6.
Tell the user:
✅ Moodle session refreshed successfully. Your session is now active and will remain valid until your next login or ~24 hours of inactivity.
The moodle-cli plugin will automatically pick up the new session on the next tool call.
openclaw config get moodle-cli./my/ first ({moodleUrl}/my/) then check cookies again.