Skip to content
Back to skills

Fetch Missing Credentials

ASecurity

Use when writing cross-origin fetch() calls that require cookies or session auth to ensure `credentials: 'include'` is set.

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
securityapibackendsecurity

Works with

  • api

Security analysis

A100/100

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

Scanned September 12, 2026

npx -y skills add aibot88/sec_skill_store --skill fetch-missing-credentials --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Fetch Missing Credentials?

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

Security grade badge for Fetch Missing Credentials
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aibot88-fetch-missing-credentials/badge)](https://www.skillsdirectory.com/skills/aibot88-fetch-missing-credentials)

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: immunize-fetch-missing-credentials
description: Use when writing cross-origin fetch() calls that require cookies or session auth to ensure `credentials: 'include'` is set.
---

# fetch-missing-credentials

When you call a cross-origin endpoint that requires cookies, session tokens,
or any credentialed auth, include `credentials: 'include'` in the fetch
options. Browsers default to `credentials: 'same-origin'`, which drops
cookies on cross-origin requests — the backend rejects the call with
401/403 and the response fails CORS preflight.

## Example

Wrong — bare fetch to another origin; cookies won't be sent:

```jsx
async function fetchUser() {
  const response = await fetch('https://api.example.com/me');
  return response.json();
}
```

Right — credentials flag forces cookies to travel:

```jsx
async function fetchUser() {
  const response = await fetch('https://api.example.com/me', {
    credentials: 'include',
  });
  return response.json();
}
```

## Server side must match

For `credentials: 'include'` to work, the server must respond with
`Access-Control-Allow-Credentials: true` AND an explicit
`Access-Control-Allow-Origin: <origin>` (never `*`). If either is
missing, the browser blocks the response even though the network call
succeeded.

## When not to use it

Same-origin requests, public endpoints, and requests that rely on a
Bearer token in the `Authorization` header don't need this flag. Adding
it unnecessarily is a minor security footgun — the browser sends cookies
the endpoint doesn't care about.

Files in this skill

  • SKILL.md1.5 KB
  • source.json687 B

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.

Comments

Loading comments…

Newsletter

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