Back to skills
SKILL.md
Api Fetch With Auth Jawad Chaudhary Hackathone 2 Todo Sp 3
ASecurityCreate authenticated API fetch function in Next.js. Use for frontend API calls.
- 666 stars
- 0 votes
- 0 copies
- 1 view
- Added June 2, 2026
Works with
Security analysis
100/100npx -y skills add majiayu000/claude-skill-registry --skill api-fetch-with-auth-jawad-chaudhary-hackathone-2-todo-sp-3 --agent claude-codeAre you the author of Api Fetch With Auth Jawad Chaudhary Hackathone 2 Todo Sp 3?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/majiayu000-api-fetch-with-auth-jawad-chaudhary-hackathone-2-t)---
name: api-fetch-with-auth
description: Create authenticated API fetch function in Next.js. Use for frontend API calls.
---
# APIFetchWithAuth Instructions
Input: Endpoint, method, body.
Output: Fetch function.
Steps:
1. Import getSession from better-auth/nextjs.
2. Attach Bearer token.
Example Code:
import { getSession } from 'better-auth/nextjs';
async function apiFetch(url: string, method: string, body?: any) {
const session = await getSession();
const token = session?.token;
return fetch(url, {
method,
headers: { Authorization: `Bearer ${token}` },
body: body ? JSON.stringify(body) : undefined,
});
}Attribution
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.