Skip to content
Back to skills

Worldai Auth

ASecurity

Authenticate with the WorldAI Firebase project for Your Project

  • 6 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added November 26, 2026
securitypythongobashnodetestingapi

Works with

  • claude code
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 26, 2026

npx -y skills add jleechanorg/jleechan-skills --skill worldai-auth --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Worldai Auth?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Worldai Auth
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jleechanorg-worldai-auth/badge)](https://www.skillsdirectory.com/skills/jleechanorg-worldai-auth)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: worldai-auth
description: Authenticate with the WorldAI Firebase project for Your Project
type: setup
scope: project
---

# WorldAI Authentication Setup

Use this skill when you need an ID token for the **WorldAI** Firebase project
(`$FIREBASE_PROJECT_ID`).

## Prerequisites

| Variable | Meaning |
|---|---|
| `FIREBASE_PROJECT_ID` | WorldAI Firebase project id (required; never derived) |
| `FIREBASE_API_KEY` | Web API key of that project (`WORLDAI_FIREBASE_API_KEY` also accepted) |
| `AUTH_CLI_PATH` | Optional path to the generic `auth-cli.mjs`; default is `${CLAUDE_HOME:-$HOME/.claude}/scripts/auth-cli.mjs` |

If a required variable is unset, the wrapper prints `<VAR> not configured` and exits.

## Auth Scripts Location

- `scripts/auth-worldai.mjs` in this skill's directory — WorldAI project auth wrapper.
- `auth-cli.mjs` — the generic multi-project auth CLI that the wrapper calls. The main
  skills export installs it to `${CLAUDE_HOME:-$HOME/.claude}/scripts/`.

## Commands

Run these with `<skill-dir>` set to this skill's base directory (Claude Code shows it
when the skill loads):

```bash
# Login for WorldAI (interactive browser OAuth)
node <skill-dir>/scripts/auth-worldai.mjs login

# Get a token (auto-refreshes expired tokens using refresh token)
node <skill-dir>/scripts/auth-worldai.mjs token

# Check status
node <skill-dir>/scripts/auth-worldai.mjs status
```

## Token Locations

Tokens are stored by `auth-cli.mjs` under `~/.ai-universe/`:
- `~/.ai-universe/auth-token-${FIREBASE_PROJECT_ID}.json` — WorldAI tokens
- `~/.ai-universe/auth-token-<project-id>.json` — tokens for any other project

Token file schema (camelCase keys):
```json
{
  "idToken": "...",
  "refreshToken": "...",
  "expiresAt": "2026-01-01T00:00:00.000Z"
}
```

## Manual Token Refresh

If the auth-worldai.mjs wrapper fails, refresh the WorldAI token directly:
```python
import urllib.request, urllib.parse, json, os, datetime

project_id = os.environ['FIREBASE_PROJECT_ID']
token_path = os.path.expanduser(f'~/.ai-universe/auth-token-{project_id}.json')
with open(token_path) as f:
    token_data = json.load(f)

url = 'https://securetoken.googleapis.com/v1/token?key=<FIREBASE_API_KEY>'
data = urllib.parse.urlencode({
    'grant_type': 'refresh_token',
    'refresh_token': token_data['refreshToken']
}).encode()
req = urllib.request.Request(url, data=data, headers={'Content-Type': 'application/x-www-form-urlencoded'})
with urllib.request.urlopen(req, timeout=15) as resp:
    result = json.loads(resp.read())

# Update token file preserving camelCase schema
token_data['idToken'] = result['id_token']
token_data['refreshToken'] = result['refresh_token']
token_data['expiresAt'] = (datetime.datetime.now(datetime.timezone.utc)
    + datetime.timedelta(seconds=int(result['expires_in']))).isoformat()
with open(token_path, 'w') as f:
    json.dump(token_data, f, indent=2)
```

## Testing Against a Deployed Server

When using the `--server` flag with testing_mcp tests against a deployed server
(`--server "$MCP_SERVER_URL"`, for example `https://<dev-service-url>`), the MCPClient
auto-loads the auth token from `~/.ai-universe/auth-token-${FIREBASE_PROJECT_ID}.json`
and passes it as a `Bearer` token. Ensure the token is refreshed before running.

If you see project mismatch errors, re-run login with the correct project-specific script.

Files in this skill

  • SKILL.md3.3 KB
  • scripts/auth-worldai.mjs2.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.