api-authentication
仓库创建 2025年11月8日最近提交 29 天前SkillHot 收录 22 天前
▸ 精选理由
覆盖常见认证场景与错误排查,适合搭建安全 API 的团队参考。
▸ 风险提示
涉及密钥与令牌管理,若实现不当会产生安全风险。
这个 Skill 做什么
实现现代 API 认证(JWT、OAuth2、API Key)与安全最佳实践指南。
提供常见的 API 认证方案比较和实作建议,包含 JWT、OAuth 2.0、API Key 的使用场景、token 管理、刷新与撤销策略以及安全 headers 等细节。适合接入第三方、服务间通信或搭建认证系统时参考。亮点是既讲原理也给落地方案,方便在不同场景选最合适的认证方式。
▸ 展开 SKILL.md 英文原文
Secure API authentication with JWT, OAuth 2.0, API keys. Use for authentication systems, third-party integrations, service-to-service communication, or encountering token management, security headers, auth flow errors.
180
Stars
28
Forks
40
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/secondsky/claude-skills/main/plugins/api-authentication/skills/api-authentication/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/secondsky/claude-skills/main/plugins/api-authentication/skills/api-authentication/SKILL.md"SKILL.MD 节选查看完整文件 ↗
# API Authentication
Implement secure authentication mechanisms for APIs using modern standards and best practices.
## Authentication Methods
| Method | Use Case | Security Level |
|--------|----------|----------------|
| JWT | Stateless auth, SPAs | High |
| OAuth 2.0 | Third-party integration | High |
| API Keys | Service-to-service | Medium |
| Session | Traditional web apps | High |
## JWT Implementation (Node.js)
```javascript
const jwt = require('jsonwebtoken');
const generateTokens = (user) => ({
accessToken: jwt.sign(
{ userId: user.id, role: user.role },
process.env.JWT_SECRET,
{ expiresIn: '15m' }
),
refreshToken: jwt.sign(
{ userId: user.id, type: 'refrvia SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有