get-convex/agent-skills

convex-setup-auth

沿用真实登录提供商,在后端校验身份与所有权

  • 历史版本 SKILL.md
  • 中文用法已整理
  • 安装与运行未实测
先判断是否解决你的问题

convex-setup-auth 是什么?

convex-setup-auth 为Convex应用接入登录、身份映射与数据访问控制。它先识别现有提供商,再按Convex Auth、Clerk、WorkOS、Auth0等实际路线配置,并在后端从可信身份判断所有权。

中文说明由本站依据来源整理;英文原文保留在页面下方。

适合用在

  • Convex项目首次接入登录,或配置受保护函数、角色和身份映射。

这些情况不适合

  • 已有完整登录只需一行修复,却重新替换整套提供商;也不适用于非Convex后端。
按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 convex-setup-auth,然后按本页使用示例提供材料。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 convex-setup-auth

请在 Codex 的当前工作环境中安装并检查 convex-setup-auth 这个 Skill。

项目身份:get-convex/agent-skills / convex-setup-auth
来源:https://github.com/get-convex/agent-skills/blob/4b66133289fd1377a27ccee4d2c511d3199c0397/skills/convex-setup-auth/SKILL.md
已定位的源文件:skills/convex-setup-auth/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
准备输入,再按步骤执行

装好以后,具体怎么用?

准备哪些材料

  • 先检查依赖、auth.config.ts、登录组件与环境配置,确定提供商及本地/生产范围;保留对应参考与官方资料。

会得到什么

  • 提供商配置、客户端和后端连接、授权检查,以及实际登录和负面访问测试结果。

实际使用顺序

  1. 已有提供商则沿用,未确定时再作选择;读取该提供商的官方指南及对应参考。
  2. 安装与初始化后检查生成文件,补客户端provider、环境与auth.config.ts连接,不能把初始化命令成功当成集成完成。
  3. 受保护函数通过ctx.auth.getUserIdentity等后端身份校验,不信任客户端userId;按业务增加所有权、团队或角色条件。
  4. 仅在实际需要时存应用用户表,Convex Auth不随意另造平行用户体系;验证登录、拒绝未登录和跨用户访问。
使用示例

从一个具体任务开始

本站根据源文件编写的使用示例,未在本站实际运行。示例中的文件由你提供。

安装并识别 Skill 后发送

复制一个具体任务

用 convex-setup-auth 检查我的Convex+Clerk项目。保留Clerk,不新造另一套登录;核对auth.config.ts与客户端provider,为“我的订单”后端查询增加真实身份和所有权校验。验证未登录与另一用户不能读取该订单,报告实际运行范围。
预期结果

预期登录链路和数据权限都被核对;本站未执行真实账号登录。

使用前先看这些限制

使用条件与边界

  • 登录提供商验证身份,应用仍需按业务执行资源授权。
  • 并非所有第三方登录应用都要创建Convex users表,是否持久化用户取决于需求。
针对这个 Skill 的疑问

常见问题

前端传入userId可以证明当前用户吗?

不能。前端参数可被修改,来源要求后端从可信登录身份取用户,再核对文档所有权。

需要核对时再展开原文

来源原文与资料状态

来源版本
历史源文件(2026-05-01T07:29:26+08:00);原目录已变更,本页解释所链接的历史版本,不代表当前安装方式。
源文件
已保存 SKILL.md,抓取于 2026-11-17T10:54:39.421Z
中文使用说明
已针对下方源文件版本整理用途、用法和常见问题
安装与任务测试
本站未执行安装或任务测试
来源复核
本页中文用法已对照保存版本的完整 SKILL.md 阅读整理
展开 SKILL.md 原文、章节与历史收录资料

skills/convex-setup-auth/SKILL.md · 抓取时间 2026-11-17T10:54:39.421Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 description(原文)

Sets up Convex auth, identity mapping, and access control. Use for login, auth providers, users tables, protected functions, or roles in a Convex app.

查看源文件章节 / Source sections
  • 原文:Convex Authentication Setup
  • 原文:When to Use
  • 原文:When Not to Use
  • 原文:First Step: Choose the Auth Provider
  • 原文:After Choosing a Provider
  • 原文:Core Pattern: Protecting Backend Functions
  • 工作流程 / Workflow
  • 原文:Reference Files
  • 原文:Provider References
  • 原文:Checklist
原文:Convex Authentication Setup

Implement secure authentication in Convex with user management and access control.

原文:When to Use

- Setting up authentication for the first time - Implementing user management (users table, identity mapping) - Creating authentication helper functions - Setting up auth providers (Convex Auth, Clerk, WorkOS AuthKit, Auth0, custom JWT)

原文:When Not to Use

- Auth for a non-Convex backend - Pure OAuth/OIDC documentation without a Convex implementation - Debugging unrelated bugs that happen to surface near auth code - The auth provider is already fully configured and the user only needs a one-line fix

原文:First Step: Choose the Auth Provider

Convex supports multiple authentication approaches. Do not assume a provider. Before writing setup code: 1. Ask the user which auth solution they want, unless the repository already makes it obvious 2. If the repo already uses a provider, continue with that provider unless the user wants to switch 3. If the user has not chosen a provider and the repo does not make it obvious, ask before proceeding Common options: - [Convex Auth](https://docs.convex.dev/auth/convex-auth) - good default when the user wants auth handled directly in Convex - [Clerk](https://docs.convex.dev/auth/clerk) - use when the app already uses Clerk or the user wants Clerk's hosted auth features - [WorkOS AuthKit](https://docs.convex.dev/auth/authkit/) - use when the app already uses WorkOS or the user wants AuthKit specifically - [Auth0](https://docs.convex.dev/auth/auth0) - use when the app already uses Auth0 - Custom JWT provider - use when integrating an existing auth system not covered above Look for signals in the repo before asking: - Dependencies such as `@clerk/*`, `@workos-inc/*`, `@auth0/*`, or Convex Auth packages - Existing files such as `convex/auth.config.ts`, auth middleware, provider wrappers, or login components - Environment variables that clearly point at a provider

原文:After Choosing a Provider

Read the provider's official guide and the matching local reference file: - Convex Auth: [official docs](https://docs.convex.dev/auth/convex-auth), then `references/convex-auth.md` - Clerk: [official docs](https://docs.convex.dev/auth/clerk), then `references/clerk.md` - WorkOS AuthKit: [official docs](https://docs.convex.dev/auth/authkit/), then `references/workos-authkit.md` - Auth0: [official docs](https://docs.convex.dev/auth/auth0), then `references/auth0.md` The local reference files contain the concrete workflow, expected files and env vars, gotchas, and validation checks. Use those sources for: - package installation - client provider wiring - environment variables - `convex/auth.config.ts` setup - login and logout UI patterns - framework-specific setup for React, Vite, or Next.js For shared auth behavior, use the official Convex docs as the source of truth: - [Auth in Functions](https://docs.convex.dev/auth/functions-auth) for `ctx.auth.getUserIdentity()` - [Storing Users in the Convex Database](https://docs.convex.dev/auth/database-auth) for optional app-level user storage - [Authentication](https://docs.convex.dev/auth) for general auth and authorization guidance - [Convex Auth Authorization](https://labs.convex.dev/auth/authz) when the provider is Convex Auth Prefer official docs over recalled steps, because provider CLIs and Convex Auth internals change between versions. Inventing setup from memory risks outdated patterns. For third-party providers, only add app-level user storage if the app actually needs user documents in Convex. Not every app needs a `users` table. For Convex Auth, follow the Convex Auth docs and built-in auth tables rather than adding a parallel `users` table plus `storeUser` flow, because Convex Auth already manages user records internally. After running provider initialization commands, verify generated files and complete the post-init wiring steps the provider reference calls out. Initialization commands rarely finish the entire integration.

原文:Core Pattern: Protecting Backend Functions

The most common auth task is checking identity in Convex functions. ```ts // Bad: trusting a client-provided userId export const getMyProfile = query({ args: { userId: v.id("users") }, handler: async (ctx, args) => { return await ctx.db.get(args.userId); }, }); ``` ```ts // Good: verifying identity server-side export const getMyProfile = query({ args: {}, handler: async (ctx) => { const identity = await ctx.auth.getUserIdentity(); if (!identity) throw new Error("Not authenticated"); return await ctx.db .query("users") .withIndex("by_tokenIdentifier", (q) => q.eq("tokenIdentifier", identity.tokenIdentifier), ) .unique(); }, }); ```

文件 SHA256:771d9fb3c0e4c3ecad71634e3acdd1c69f5e8529879a036005fa9a680c8ffbfb

仓库许可证记录:未提供;not-established,查看来源。

Skills.sh收录简介 · 2026-07-28

Sets up Convex auth, identity mapping, and access control. Use for login, auth providers, users tables, protected functions, or roles in a Convex app.

查看历史简介来源

历史收录数据

Skill标识convex-setup-auth
来源仓库get-convex/agent-skills
榜单快照2026-07-28
榜单口径Skills.sh累计安装量
快照名次232
快照累计安装量91930

历史资料说明

  • 安装量用于说明当时的收录次序,不是效果、可信度或当前可用性的证明。

此页用于识别项目与来源。安装入口可在该Skill的Skills.sh页面查看;当前目录是否仍存在、附带脚本和账户依赖尚需按具体版本确认。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源