Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计通过

auth0-fastifyauth0 快速化

Agent Skill

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

总安装

4,069

周安装

173

GitHub Stars

17

下载量

1,426
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:auth0-fastify(auth0 快速化)
来源仓库:https://github.com/auth0/agent-skills
仓库路径:skills/auth0-fastify
安装命令:
npx skills add https://github.com/auth0/agent-skills --skill auth0-fastify
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/auth0/agent-skills --skill auth0-fastify

简介

用于辅助安全审计、权限检查、凭据风险和认证流程排查。

  • 适合梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。
  • 通过系统步骤发现项目结构、识别认证文件和中间件配置,提供路由保护建议。
  • 使用时不能把工具输出直接当最终结论,涉及密钥、令牌或生产系统时应确认最小权限和操作边界。
  • auth0-fastify 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Auth0 Fastify Integration

Add authentication to Fastify web applications using @auth0/auth0-fastify.


Prerequisites

  • Fastify application (v5.x or newer)
  • Node.js 20 LTS or newer
  • Auth0 account and application configured
  • If you don't have Auth0 set up yet, use the auth0-quickstart skill first

When NOT to Use

  • Single Page Applications - Use auth0-react, auth0-vue, or auth0-angular for client-side auth
  • Next.js applications - Use auth0-nextjs skill which handles both client and server
  • Mobile applications - Use auth0-react-native for React Native/Expo
  • Stateless APIs - Use @auth0/auth0-fastify-api instead for JWT validation without sessions
  • Microservices - Use JWT validation for service-to-service auth

Quick Start Workflow

1. Install SDK

npm install @auth0/auth0-fastify fastify @fastify/view ejs dotenv

2. Configure Environment

Create .env:

AUTH0_DOMAIN=your-tenant.auth0.com
AUTH0_CLIENT_ID=your-client-id
AUTH0_CLIENT_SECRET=your-client-secret
SESSION_SECRET=<openssl-rand-hex-64>
APP_BASE_URL=http://localhost:3000

Generate secret: openssl rand -hex 64

3. Configure Auth Plugin

Create your Fastify server (server.js):

import 'dotenv/config';
import Fastify from 'fastify';
import fastifyAuth0 from '@auth0/auth0-fastify';
import fastifyView from '@fastify/view';
import ejs from 'ejs';

const fastify = Fastify({ logger: true });

// Register view engine
await fastify.register(fastifyView, {
  engine: { ejs },
  root: './views',
});

// Configure Auth0 plugin
await fastify.register(fastifyAuth0, {
  domain: process.env.AUTH0_DOMAIN,
  clientId: process.env.AUTH0_CLIENT_ID,
  clientSecret: process.env.AUTH0_CLIENT_SECRET,
  appBaseUrl: process.env.APP_BASE_URL,
  sessionSecret: process.env.SESSION_SECRET,
});

fastify.listen({ port: 3000 });

This automatically creates:

  • /auth/login - Login endpoint
  • /auth/logout - Logout endpoint
  • /auth/callback - OAuth callback

4. Add Routes

// Public route
fastify.get('/', async (request, reply) => {
  const session = await fastify.auth0Client.getSession({ request, reply });
  return reply.view('views/home.ejs', {
    isAuthenticated: !!session,
  });
});

// Protected route
fastify.get('/profile', {
  preHandler: async (request, reply) => {
    const session = await fastify.auth0Client.getSession({ request, reply });
    if (!session) {
      return reply.redirect('/auth/login');
    }
  }
}, async (request, reply) => {
  const user = await fastify.auth0Client.getUser({ request, reply });
  return reply.view('views/profile.ejs', { user });
});

5. Test Authentication

Start your server:

node server.js

Visit http://localhost:3000 and test the login flow.


Common Mistakes

MistakeFix
Forgot to add callback URL in Auth0 DashboardAdd /auth/callback path to Allowed Callback URLs (e.g., http://localhost:3000/auth/callback)
Missing or weak SESSION_SECRETGenerate secure 64-char secret with openssl rand -hex 64 and store in.env
App created as SPA type in Auth0Must be Regular Web Application type for server-side auth
Session secret exposed in codeAlways use environment variables, never hardcode secrets
Wrong appBaseUrl for productionUpdate APP_BASE_URL to match your production domain
Not awaiting fastify.registerFastify v4+ requires awaiting plugin registration

Related Skills

  • auth0-quickstart - Basic Auth0 setup
  • auth0-migration - Migrate from another auth provider
  • auth0-mfa - Add Multi-Factor Authentication

Quick Reference

Plugin Options:

  • domain - Auth0 tenant domain (required)
  • clientId - Auth0 client ID (required)
  • clientSecret - Auth0 client secret (required)
  • appBaseUrl - Application URL (required)
  • sessionSecret - Session encryption secret (required, min 64 chars)
  • audience - API audience (optional, for calling APIs)

Client Methods:

  • fastify.auth0Client.getSession({request, reply}) - Get user session
  • fastify.auth0Client.getUser({request, reply}) - Get user profile
  • fastify.auth0Client.getAccessToken({request, reply}) - Get access token
  • fastify.auth0Client.logout(options, {request, reply}) - Logout user

Common Use Cases:

  • Protected routes → Use preHandler to check session (see Step 4)
  • Check auth status → !!session
  • Get user info → getUser({request, reply})
  • Call APIs → getAccessToken({request, reply})

References

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

39.4%
按下载量换算562

Claude

28.29%
按下载量换算403

Cursor

19.19%
按下载量换算274

Gemini CLI

8.64%
按下载量换算123

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills