handling-authentication-errors

handling-authentication-errors is a skill for Claude Code from ryan-haver/fusebase-mcp. It costs 68 tokens per session (2,693 once invoked), scanned A, a copy of handling-authentication-errors, MIT.

A guide to handling authentication and session errors in Fusebase apps. It covers platform-token failures, checking whether a logged-in session is still valid, and showing or handling expired sessions.

In plain words
What is it for?
Use it when implementing login checks, expired-session dialogs, startup session checks, or shared API error handling.
Why use it?
It helps apps respond consistently when tokens or browser sessions are invalid or have expired.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions AGENTS.md.

Part of the fusebase plugin — 16 skills, 2 agents, 1 hook, 1 MCP server shipped together

Good fit Use it when implementing login checks, expired-session dialogs, startup session checks, or shared API error handling.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ryan-haver/fusebase-mcp/handling-authentication-errors
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ryan-haver/fusebase-mcp --skill handling-authentication-errors
Clone the repo
git clone --depth 1 https://github.com/ryan-haver/fusebase-mcp

Made for: Claude Code.

Or install fusebase, the plugin that ships this one along with the rest of its 16 skills, 2 agents, 1 hook, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for handling-authentication-errors

README.md
[![agentmods](https://agentmods.dev/badge/skills/ryan-haver/fusebase-mcp/handling-authentication-errors/github.svg)](https://agentmods.dev/skills/ryan-haver/fusebase-mcp/handling-authentication-errors)
Your own site
<a href="https://agentmods.dev/skills/ryan-haver/fusebase-mcp/handling-authentication-errors"><img src="https://agentmods.dev/badge/skills/ryan-haver/fusebase-mcp/handling-authentication-errors/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for handling-authentication-errors

Your own site · 80×15
<a href="https://agentmods.dev/skills/ryan-haver/fusebase-mcp/handling-authentication-errors"><img src="https://agentmods.dev/badge/skills/ryan-haver/fusebase-mcp/handling-authentication-errors.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,693 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 92% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00068 $0.02693
Opus 5.5 $0.00027 $0.01077
Sonnet 5.5 $0.00014 $0.00539
Haiku 4.5 $0.00007 $0.00269

Measured 1mo ago against content hash 7b95f0e59b9c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

handling-authentication-errors scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

92% identical to handling-authentication-errors — 52 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

apps/client-portal-dashboard/.claude/skills/handling-authentication-errors/SKILL.md · 246 lines

How it starts

The opening of the file, as written. The whole thing — 246 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Handling Authentication Errors

Apps need two related but distinct patterns:

  1. Platform app token (fbsfeaturetoken / x-app-feature-token) — AppTokenValidationError on Gate/Dashboard proxy calls.
  2. App-owned session (httpOnly cookie, e.g. app_session) — backend /api/account/me (or equivalent) on load.

Do not treat every failed fetch as “logged out”. That lies to the user when the backend is restarting (deploy), the proxy returns 502, or the network blips.


Session probe invariant (backend SaaS apps)

Any SPA that boots auth from GET /api/account/me (or similar) MUST follow this table:

Response on session check Meaning UI action
401 Session rejected by backend Show login / anon state
403 with known business code (membership_revoked, tenant_suspended, …) Authenticated but blocked Dedicated blocked screen
Everything else (502/503/504, 5xx, network error, timeout, aborted) No verdict — server may be down Retry (see below), then “Can't reach server” + Try again. Do not clear session cookie or force login

A timeout on the first call after idle or deploy is a cold start, not a logout. Retry once with the full deadline, then report "Can't reach server" — never clear the session. Timeout sizing: skill app-backend § Cold Starts (Scale-to-Zero).

Anti-pattern (never ship)

// BAD — treats deploy blip as logout
catch (e) {
  if (e.code !== 'tenant_suspended' && e.code !== 'membership_revoked') {
    setAuth({ status: 'anon' }) // ← 502 during fusebase deploy looks like logout
  }
}

Required pattern

type SessionVerdict = 'authenticated' | 'anon' | 'blocked' | 'unknown'

async function probeSession(): Promise<SessionVerdict> {
  const res = await fetch('/api/account/me', { credentials: 'include' })
  if (res.status === 401) return 'anon'
  if (res.status === 403) {
    const body = await res.json().catch(() => ({}))
    if (body.code === 'membership_revoked' || body.code === 'tenant_suspended') return 'blocked'
    return 'unknown' // do not assume logout
  }
  if (!res.ok) return 'unknown'
  return 'authenticated'
}

async function probeSessionWithDeployTolerance(): Promise<SessionVerdict> {
  const delays = [0, 400, 1200] // ms — survives fusebase deploy pod restart window
  let last: SessionVerdict = 'unknown'
  for (const ms of delays) {
    if (ms) await new Promise((r) => setTimeout(r, ms))
    try {
      const v = await probeSession()
      if (v !== 'unknown') return v
      last = v
    } catch {
      last = 'unknown'
    }
  }
  return last
}

Read the full file on GitHub · 246 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 246 lines · 68 tokens per session scan A 7b95f0e59b9c

Subscribe to this mod's changes

handling-authentication-errors is a skill published in the GitHub repository ryan-haver/fusebase-mcp (8 stars, last pushed 3d ago), licensed MIT. It adds 68 tokens to every session and 2,693 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 92% identical to handling-authentication-errors, differing in 52 lines, and is treated as a copy.

Related

handling-authentication-errors compared with skills from other repositories

handling-authentication-errors next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
handling-authentication-errorsryan-haver/fusebase-mcpSkill83d agoMITA68Claude Code
mem0-oss-to-platformmem0ai/mem0Skill69kyesterdayApache-2.0A217Claude Code, Codex
azure-mgmt-botservice-dotnetmicrosoft/skillsSkill3.2kyesterdayMITA78Claude Code
fastapi-router-pymicrosoft/skillsSkill3.2kyesterdayMITA46Claude Code
dev-runtimelangwatch/langwatchSkill5.0ktodayApache-2.0A172Claude Code
api-designericrisco/rsc-harnessSkill5293d agoMITA105Claude Code, Codex
migrate-segw-to-raparc-mcp/arc-1Skill253todayMITA106Claude Code