agentleFS
thoitiettxl-cyberthoitiettxl-cyber/Claw-II/skills/tailscale-oauth-bridge/SKILL.md

tailscale-oauth-bridge

Skill2 starsChanged 7 months agoMITView on GitHub

Use Tailscale + SSH local forwarding to handle OAuth loopback callback (localhost) from PC to Android phone when authenticating Codex/cli-proxy-api.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check results, state validation, and next steps.

    line 17
  2. Distinctive:

    Do not expose ports to the Internet.

    line 38
  3. Distinctive:

    Keep the SSH tunnel alive during the entire auth process.

    line 66
  4. Very specific:

    If there is a 302 to http://127.0.0.1:8317/codex/callback, browser can still follow because of tunnel 8317.

    line 72
  5. Very specific:

    Verify after each account: call http://127.0.0.1:8317/v1/models and check auth success logs.

    line 73
  6. Very specific:

    Use -p 8022 and ensure sshd is running.

    line 79
  7. Distinctive:

    Use SSH key when stable, avoid long-term password auth.

    line 91
  8. Distinctive:

    Do not use Funnel/public expose for this flow.

    line 93
  9. Distinctive:

    If loopback callback still cannot reach PC: verify correct local forward/port map before suspecting OAuth provider.

    line 101
  10. Distinctive:

    If Tailscale IP/route cannot reach phone: split triage into tailnet connectivity and SSH tunnel instead of debugging the whole stack at …

    line 102
  11. Distinctive:

    If auth flow is complete: remind to close tunnel and clear temporary session to reduce exposure.

    line 103

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tailscale OAuth Bridge

Standardize the multi-account auth flow on PC for services running on phone, when redirect_uri is hard-locked as loopback (for example http://localhost:1455/auth/callback).

Scope

  • In-scope: use Tailscale + SSH local forwarding to handle OAuth loopback callback from PC to Android phone.
  • Out-of-scope: general network tunneling outside the OAuth callback bridge problem.

SOP

  1. Determine whether the request is within the skill scope.
  2. Execute the skill's main workflow/instructions in safe order.
  3. Check results, state validation, and next steps.

Indexed sub-skill references (source map)

  • @[SKILL.md#L1-L95] Standard frontmatter (name, description).
  • @[SKILL.md#L6-L95] Tailscale OAuth Bridge.
  • @[SKILL.md#L10-L95] When to use.
  • @[SKILL.md#L15-L95] Goals.
  • @[SKILL.md#L20-L95] Preconditions.
  • @[SKILL.md#L27-L95] Standard commands.
  • @[SKILL.md#L48-L95] Standard auth process.
  • @[SKILL.md#L55-L95] Quick troubleshooting.
  • @[SKILL.md#L69-L95] Hardening.

When to use

  • OAuth URL has redirect_uri=http://localhost:<port>/....
  • Service actually runs on phone (Android), but login is needed from browser on PC.
  • Cannot switch to a custom domain due to invalid_redirect_uri/hard whitelist.

Goals

  • Browser on PC can still log in normally.
  • localhost callback on PC is safely forwarded to phone via tailnet.
  • Do not expose ports to the Internet.

Preconditions

  1. PC and phone are both logged into the same Tailscale tailnet.
  2. Phone has an SSH server (Termux sshd on port 8022 is recommended).
  3. Service on phone is handling the callback flow:
    • callback listener: 127.0.0.1:1455
    • codex callback/backend: 127.0.0.1:8317

Standard commands

On phone (Termux)

pkg update -y && pkg install -y openssh
passwd
sshd
whoami

On PC

tailscale status
ssh -p 8022 -N \
  -L 1455:127.0.0.1:1455 \
  -L 8317:127.0.0.1:8317 \
  <TERMUX_USER>@<PHONE_TAILSCALE_IP>

Keep the SSH tunnel alive during the entire auth process.

Standard auth process

  1. Initialize auth flow on phone to generate OAuth URL.
  2. Copy URL to PC, open in browser/Google profile that needs adding account.
  3. OpenAI redirects to localhost:1455 (PC) -> tunnel forwards to phone.
  4. If there is a 302 to http://127.0.0.1:8317/codex/callback, browser can still follow because of tunnel 8317.
  5. Verify after each account: call http://127.0.0.1:8317/v1/models and check auth success logs.

Quick troubleshooting

ssh: connect ... port 22: Connection refused

  • Phone doesn't have SSH server on 22 yet (normal with Termux).
  • Use -p 8022 and ensure sshd is running.

Browser shows 127.0.0.1 refused

  • Callback listener on phone is not open at test time.
  • Initialize auth flow first, then open URL.

302 -> 127.0.0.1:8317 but fails

  • Missing port 8317 forwarding on PC.
  • Add -L 8317:127.0.0.1:8317.

Hardening

  • Allow only Boss's PC device in tailnet ACL.
  • Use SSH key when stable, avoid long-term password auth.
  • End auth session: close tunnel immediately.
  • Do not use Funnel/public expose for this flow.

Trigger Rules

  • Positive: Activate when user request matches tailscale-oauth-bridge by description: Use Tailscale + SSH local forwarding to handle OAuth loopback callback (localhost) from PC to Android phone when authenticating Codex/cli-proxy-api.
  • Negative: Do not activate for out-of-scope requests or when this skill's workflow/expertise is not needed.
  • Escalation: If there is external action/network write or sensitive operations, add an approval checkpoint before execution.

Error Handling

  • If loopback callback still cannot reach PC: verify correct local forward/port map before suspecting OAuth provider.
  • If Tailscale IP/route cannot reach phone: split triage into tailnet connectivity and SSH tunnel instead of debugging the whole stack at once.
  • If auth flow is complete: remind to close tunnel and clear temporary session to reduce exposure.

Output Contract

  • Deliverable: result aligned with tailscale-oauth-bridge objective; clearly state artifact/path/steps performed (if any).
  • Validation: report PASS/FAIL status with key checks run.
  • Failure mode: when failing, state root cause + proposed remediation.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.