api-fetch-with-auth

Community

Secure API fetch for Next.js apps.

AuthorJawad-Chaudhary
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill simplifies making authenticated API requests from a Next.js frontend by automatically attaching the user's Bearer token to requests, reducing boilerplate and potential errors.

Core Features & Use Cases

  • Reusable fetch function: apiFetch(url, method, body) that automatically includes the Authorization header.
  • Token handling: retrieves the token from getSession and uses it for all calls.
  • Use Case: fetch data from protected endpoints in a Next.js application.

Quick Start

Create the apiFetch function by importing getSession from better-auth/nextjs and using it to attach the Bearer token to the Authorization header for the request.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: api-fetch-with-auth
Download link: https://github.com/Jawad-Chaudhary/Hackathone-2-TODO-Spec-Driven-Development/archive/main.zip#api-fetch-with-auth

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.