# openrouter-oauth

openrouter-oauth adds Sign In with OpenRouter to browser apps via OAuth PKCE without a backend, SDK, or client credentials.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 362 installs · ★ 327 repo stars
- Author: OpenRouterTeam
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/OpenRouterTeam/skills/tree/HEAD/skills/openrouter-oauth/SKILL.md
- Updated: 2026-10-24
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/openrouter-oauth

## What it does

This skill guides the agent in writing browser-only authentication code for OpenRouter. The user grants access on OpenRouter and your client app receives an API key. Everything relies on PKCE: random 32 bytes from the Web Crypto API turn into an S256 challenge, eliminating the need for client secrets.

The logic covers every step of the redirect round-trip: saving the one-time verifier to `sessionStorage`, verifying the returning `code` parameter, exchanging it at the OpenRouter keys endpoint, and stripping the query string with `history.replaceState`. It also sets up cross-tab synchronization with the `storage` event and supplies the brand SVG logo.

Without Web Crypto API and web storage in the environment, this implementation will fail.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-oauth -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/openrouter-oauth/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/openrouter-oauth/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-oauth -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/openrouter-oauth/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-oauth -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/openrouter-oauth/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install OpenRouterTeam/skills skills/openrouter-oauth
```

2. **Manually: put the files in place**
- File: `.github/skills/openrouter-oauth/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-oauth -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/OpenRouterTeam/skills --path skills/openrouter-oauth
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/openrouter-oauth/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-oauth -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/OpenRouterTeam/skills/tree/HEAD/skills/openrouter-oauth/SKILL.md

## When to use it
- integrate OpenRouter sign-in without running an authentication backend
- generate PKCE verifiers and SHA-256 challenges directly in client JavaScript
- obtain an OpenRouter inference API key from a browser redirect flow
- sync OpenRouter session state across browser tabs via storage events

## Example prompts
- Implement OpenRouter OAuth PKCE authentication for my single-page app
- Add a Sign In with OpenRouter button using the provided SVG mark
- Write a handler that takes the auth code from the URL and exchanges it for a key

## Similar
- [oauth-oidc-misconfiguration](https://affpapa.org/en/nevibecode/skills/oauth-oidc-misconfiguration.md) — skill · 4100 installs
- [oauth](https://affpapa.org/en/nevibecode/skills/mcollina-oauth.md) — skill · 1400 installs
- [oauth-implementation](https://affpapa.org/en/nevibecode/skills/oauth-implementation.md) — skill · 768 installs
- [oauth-oidc-implementer](https://affpapa.org/en/nevibecode/skills/oauth-oidc-implementer.md) — skill · 183 installs
- [mcp-oauth](https://affpapa.org/en/nevibecode/skills/mcp-oauth.md) — skill · 21 installs
- [oauth-oidc-expert](https://affpapa.org/en/nevibecode/agents/oauth-oidc-expert.md) — subagent · ★ 1029 repo stars

From the same set: [openrouterteam/skills](https://affpapa.org/en/nevibecode/by/openrouterteam/skills.md) — 16 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
