Skip to main content
Glama
okta-auth

okta-auth

by bunizao

okta-auth

Sign in to Okta apps without a browser.

Give it a URL, your university username, password and TOTP secret. It walks Okta's sign-in over plain HTTP, MFA included, and hands back the cookies the app set. The same fetch-only core runs in Node, Bun, Python and Cloudflare Workers, so a remote MCP server can sign itself in.

Use it as a CLI, a TypeScript or Python library, or the sign-in step of your own Worker.

npm version PyPI version CI Cloudflare Workers MIT License

🦄 Part of unicorn. The sign-in step the live tools share, so none of them needs a browser.

📖 Read the docs: TypeScript · Python

Set up

Ask your agent (Claude Code, Codex, or anything with a terminal):

Install okta-auth-cli from npm, run `okta-auth setup`, then sign me in to https://learning.monash.edu/login/index.php.

okta-auth setup opens a page in your browser. It finds your Okta login in 1Password or saves it to the macOS Keychain, then tries a sign-in. Your password never passes through the agent.

Or by hand:

npm install -g okta-auth-cli
okta-auth setup
okta-auth login https://learning.monash.edu/login/index.php

With Python, uv tool install okta-auth-cli gives you the okta CLI and an okta-auth MCP server instead.

Related MCP server: Agent Identity MCP Server

Use it from

Where

How

Your terminal and scripts

okta-auth login <url>, then okta-auth cookies <url> prints a Cookie header. CLI

TypeScript: Node 22+, Bun, Workers

npm install okta-auth-cli, then signIn({ url, username, password, totpSecret }). Library

Python 3.11+

uv add okta-auth-cli, then await sign_in(url=..., ...). Library

OpenConnect

okta-auth globalprotect <server> prints the one-time VPN cookie as JSON. GlobalProtect

What it signs in to

Ask your agent

Command

“Sign me in to Moodle.”

okta-auth login https://learning.monash.edu/login/index.php

“Give curl my Moodle session.”

curl -H "Cookie: $(okta-auth cookies https://learning.monash.edu)" …

“Get me a VPN cookie for OpenConnect.”

okta-auth globalprotect vpn.gp.monash.edu

“Which sessions do I have?”

okta-auth status

“Sign me out of everything.”

okta-auth logout

It follows whatever Okta Identity Engine and the app ask for:

  • Apps: SAML apps that redirect or post their request to Okta, Okta app links (the tiles on your Okta dashboard), OIDC apps that Okta redirects back to, and GlobalProtect gateways and portals.

  • MFA: a TOTP code from Google Authenticator or Okta Verify. It picks the code over push, and can ask 1Password for the code so the secret stays there.

  • Policies: it skips optional prompts such as a password-expiry warning or an optional new authenticator. When Okta needs a browser instead (an expired password, a required new authenticator, an external identity provider), it says so.

  • Devices: it keeps Okta's device token, so Okta doesn't see a new device each time. The library can also reuse Okta's session to sign in to a second app without MFA.

Push-only MFA, SMS, email codes, FastPass and Okta Classic Engine orgs are not supported.

Safe by design

  • It never retries a sign-in by itself. A wrong password stops after one attempt, so it can't lock your account.

  • Your password only goes to the Okta host that served the sign-in page. Cookies only go to the host that set them.

  • Errors and logs name hosts and paths only: no passwords, codes, tokens, query strings or cookie values. Tests check this.

  • No runtime dependencies. The core uses only fetch and WebCrypto.

Learn more

🦄 Part of unicorn

Live tools answer what is there now; unicorn answers what changed. okta-auth signs them in.

Project

Layer

What it does

🦄 unicorn

Memory

Remembers your campus sources and tells your agent what changed. Remote MCP.

moodle-cli

Live

Moodle. CLI, local and remote MCP.

edstem-cli

Live

Ed Discussion. CLI, local and remote MCP.

ontrack

Live

OnTrack and Doubtfire. CLI only.

okta-auth (you are here)

Sign-in

Okta sign-in without a browser. CLI and library for Node, Bun, Python and Workers.

📖 All docs · CLIs overview

License

MIT. See LICENSE.

Available Tools

5 tools
okta_check_sessionA
Read-onlyIdempotent

Verify if a stored session for a URL is still valid.

Launches a headless browser with the stored session cookies, navigates to the URL, and checks whether the session is still authenticated (not redirected to Okta login).

Args: url: URL to verify session against. Must match the URL used during login. timeout_ms: Maximum time in ms to wait for page load (5000-120000, default 30000).

Returns: JSON: {"valid": bool, "domain_key": str|null, "message": str, "url": str}

Inputs: url (required), timeout_ms. Returns: result

okta_delete_sessionA
DestructiveIdempotent

Delete a stored session for a given URL.

Removes the session file and metadata from ~/.okta-auth/sessions/. The agent will need to re-authenticate to access the service again.

Args: url: URL whose stored session should be deleted.

Returns: JSON: {"deleted": bool, "message": str, "url": str}

Inputs: url (required). Returns: result

okta_get_cookiesA
Read-onlyIdempotent

Retrieve cookies from a stored session.

Returns the raw cookie data from a stored Playwright session. Useful for making authenticated HTTP requests without launching a browser.

Args: url: URL whose stored session cookies to retrieve. domain_filter: Optional domain substring to filter cookies (e.g., 'okta.com').

Returns: JSON: {"count": int, "cookies": [{name, value, domain, path, ...}], "url": str} Error: {"error": str, "url": str}

Inputs: url (required), domain_filter. Returns: result

okta_list_sessionsA
Read-onlyIdempotent

List all stored authentication sessions.

Returns metadata for every saved session including the domain, when it was saved, and cookie/origin counts. Does NOT verify if sessions are still valid — use okta_check_session for that.

Returns: JSON: {"count": int, "sessions": [{url, domain_key, saved_at_iso, cookie_count, origin_count}]}

Inputs: no named parameters. Returns: result

okta_loginA
Idempotent

Authenticate to a website via Okta SSO and persist the session.

Launches a headless browser, navigates to the target URL, performs Okta login (including TOTP MFA if configured), and saves the browser session for later use. Sessions are stored per-domain in ~/.okta-auth/sessions/.

Credentials are resolved in order: explicit parameter → environment variable → OS keyring when the local provider is set to keyring. When the provider is set to op, launch the server through op run so the environment is populated at process start.

Args: url: Target URL to authenticate against (e.g., 'https://portal.company.com'). username: Okta username or email. Falls back to OKTA_USERNAME or stored keyring data. password: Okta password. Falls back to OKTA_PASSWORD or stored keyring data. totp_secret: Base32 TOTP secret for automated MFA. Falls back to OKTA_TOTP_SECRET or stored keyring data. headed: Show the browser window during login. Set to true for debugging. timeout_ms: Maximum time in ms to wait for page loads (5000-300000, default 60000).

Returns: JSON: {"success": bool, "domain_key": str|null, "message": str, "url": str}

Inputs: url (required), headed, password, username, +2 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.5/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: login, check, list, delete, and get cookies. No overlap or ambiguity.

    Naming Consistency5/5

    All tools follow a consistent pattern: okta_ + verb_noun (e.g., check_session, list_sessions). Even login is an action verb, fitting the pattern.

    Tool Count5/5

    5 tools cover the core operations for Okta session management: create, verify, list, delete, and export cookies. Not too few or too many for the scope.

    Completeness4/5

    Covers the main lifecycle: login, check, list, delete, and get cookies. Minor gaps like session refresh or logout are handled implicitly (delete functions as logout), but still a solid set.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers