oauth2-oidc

oauth2-oidc:协助实现 OAuth 2.0 和 OpenID Connect,以确保安全的身份验证与授权。适用于配置授权流程、验证令牌、为公共客户端实现 PKCE、设置社交登录,或为 SPA、移动应用和 API 构建安全的令牌处理机制。触发词包括 oauth、oidc、openid connect、authorization code、pkce、jwt、access token、refresh token。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "oauth2-oidc":https://skillpi.com/zh/skills/deepskill-c7e7d30db3b2da11b60fef2c29ec6bb9f6a7d384fff3476c0c2873ce4267bca8。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

oauth2-oidc:协助实现 OAuth 2.0 和 OpenID Connect,以确保安全的身份验证与授权。适用于配置授权流程、验证令牌、为公共客户端实现 PKCE、设置社交登录,或为 SPA、移动应用和 API 构建安全的令牌处理机制。触发词包括 oauth、oidc、openid connect、authorization code、pkce、jwt、access token、refresh token。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: oauth2-oidc
description: >-
  Assists with implementing OAuth 2.0 and OpenID Connect for secure authentication and
  authorization. Use when configuring authorization flows, validating tokens, implementing
  PKCE for public clients, setting up social login, or building secure token handling for
  SPAs, mobile apps, and APIs. Trigger words: oauth, oidc, openid connect, authorization
  code, pkce, jwt, access token, refresh token.
license: Apache-2.0
compatibility: "No special requirements"
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: devops
  tags: ["oauth2", "oidc", "authentication", "authorization", "jwt"]

OAuth 2.0 / OpenID Connect

Overview

OAuth 2.0 is the industry standard for API authorization, and OpenID Connect (OIDC) extends it for user authentication. Together they provide Authorization Code + PKCE for secure token exchange, JWT-based identity tokens, refresh token rotation, and integration with identity providers (Auth0, Okta, Keycloak, Google, Azure AD) for social login and enterprise SSO.

Instructions

  • When implementing authentication, use the Authorization Code + PKCE flow for all client types (SPAs, mobile, server) since it is the only secure flow; never use the deprecated Implicit or Resource Owner Password flows.
  • When validating tokens on the API side, verify the JWT signature using the provider's JWKS endpoint, check exp, iss, and aud claims, and never trust client-side token validation alone.
  • When storing tokens in web apps, use httpOnly, secure, sameSite=lax cookies; never store tokens in localStorage since it is vulnerable to XSS.
  • When managing token lifecycle, use short-lived access tokens (5-15 minutes) with refresh token rotation where each refresh token is single-use and a new one is issued with each refresh.
  • When integrating a provider, use the discovery endpoint (/.well-known/openid-configuration) for auto-configuration rather than hardcoding endpoints.
  • When implementing logout, revoke the refresh token, clear the session, and redirect to the provider's logout endpoint for complete session termination.

Examples

Example 1: Add social login to a Next.js app with PKCE

User request: "Implement Google and GitHub login for my Next.js app using OAuth 2.0"

Actions:

  1. Configure the OIDC providers with client IDs and redirect URIs
  2. Implement the Authorization Code + PKCE flow with state and nonce validation
  3. Exchange the code for tokens and validate the ID token JWT claims
  4. Store the session in httpOnly cookies with refresh token rotation

Output: A Next.js app with secure social login via Google and GitHub, PKCE-protected token exchange, and httpOnly cookie sessions.

Example 2: Secure a REST API with JWT validation

User request: "Add OAuth 2.0 token validation to my API endpoints"

Actions:

  1. Fetch the provider's JWKS from the discovery endpoint
  2. Create middleware that validates the access token signature, expiration, issuer, and audience
  3. Extract user claims and custom scopes from the validated token
  4. Return 401 for invalid tokens and 403 for insufficient scopes

Output: An API with JWT-based authorization that validates tokens against the provider's JWKS and enforces scope-based access control.

Guidelines

  • Always use Authorization Code + PKCE since it is the only secure flow for all client types.
  • Validate tokens on the API side: verify signature, exp, iss, and aud; never trust client-side validation alone.
  • Use httpOnly, secure, sameSite=lax cookies for token storage in web apps, not localStorage.
  • Implement refresh token rotation where each refresh token is single-use.
  • Use the provider's discovery endpoint for configuration rather than hardcoding endpoints.
  • Request minimum scopes needed: openid email for login, not all available scopes.
  • Implement proper logout: revoke refresh token, clear session, redirect to provider's logout endpoint.

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 提供 OAuth 2.0 和 OpenID Connect 的完整实现指导,覆盖主流应用场景(SPA、移动应用、API 安全)
  • 解决开发者高频刚需的安全认证问题,内容专业且实用
触发精准95/100

亮点

  • 触发词覆盖全面(oauth、oidc、pkce、jwt 等),边界清晰,无歧义
结构规范90/100

亮点

  • Phase/步骤清晰(Overview、Instructions、Examples、Guidelines),有端到端示例(Next.js 登录、API JWT 验证)
  • frontmatter 完整,单文件未超限
执行可靠90/100

亮点

  • 工具来源明确(行业标准协议),参数正确(PKCE、JWT 验证、cookie 设置)
  • 覆盖主要异常(token 验证失败、scope 不足),不可逆操作有确认机制(logout 流程)
证据可验 (前四项均值)92/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。