auth-nodejs-cloudbase
БесплатноБез исполняемых скриптовНе проверенComplete guide for CloudBase Auth using the CloudBase Node SDK – caller identity, user lookup, custom login tickets, and server-side best practices.
от bighardperson★ 71 звезда на GitHubОб этом скилле
When to use this skill
Use this skill whenever the task involves server-side authentication or identity in a CloudBase project, and the code is running in Node.js, for example:
- CloudBase 云函数 (Node runtime) that needs to know who is calling
- Node services that use CloudBase Node SDK to look up user information
- Backends that issue custom login tickets for Web / mobile clients
- Admin or ops tools that need to inspect CloudBase end-user profiles
Do NOT use this skill for:
- Frontend Web login / sign-up flows using
@cloudbase/js-sdk(handle those with the auth-web skill, not this Node skill). - Direct HTTP auth API integrations (this skill does not describe raw HTTP endpoints; use the http-api skill instead).
- Database or storage operations that do not involve identity (use database/storage docs or skills).
When the user request mixes frontend and backend concerns (e.g. "build a web login page and a Node API that knows the user"), treat them separately:
- Use Web-side auth docs/skills for client login and UX.
- Use this Node Auth skill for how the backend sees and uses the authenticated user.
How to use this skill (for a coding agent)
When you load this skill to work on a task:
Clarify the runtime and responsibility
Ask the user:
- Where does this Node code run?
- CloudBase 云函数
- Long‑running Node service using CloudBase
- What do they need from auth?
- Just the caller identity for authorization?
- Look up arbitrary users by UID / login identifier?
- Bridge their own user system into CloudBase via custom login?
- Where does this Node code run?
Confirm CloudBase environment and SDK
- Ask for:
env– CloudBase environment ID
- Install the latest
@cloudbase/node-sdkfrom npm if it is not already available. - Always initialize the SDK using this pattern (values can change, shape must not):
import tcb from "@cloudbase/node-sdk"; const app = tcb.init({ env: "your-env-id" }); const auth = app.auth();- Ask for:
Pick the relevant scenario from this file
- For caller identity inside a function, use the
getUserInfoscenarios. - For full user profile or admin lookup, use the
getEndUserInfoandqueryUserInfoscenarios. - For client systems that already have their own users, use the custom login ticket scenarios built on
createTicket. - For logging / security, use the
getClientIPscenario.
- For caller identity inside a function, use the
Follow Node SDK API shapes exactly
- Treat all
auth.*methods and parameter shapes in this file as canonical. - You may change variable names and framework (e.g. Express vs 云函数 handler), but do not change SDK method names or parameter fields.
- If you see a method in older code that is not listed here or in the Node SDK docs mirror, treat it as suspect and avoid using it.
- Treat all
If you are unsure about an API
- Consult the official CloudBase Auth Node SDK documentation.
- Only use methods and shapes that appear in the official documentation.
- If you cannot find an API you want:
- Prefer composing flows from the documented methods, or
- Explain that this skill only covers Node SDK auth, and suggest using the relevant CloudBase Web or HTTP auth documentation for client-side or raw-HTTP flows.
Node auth architecture – how Node fits into CloudBase Auth
CloudBase Auth v2 separates where users log in from where backend code runs:
- Users log in through the supported auth methods (anonymous, username/password, SMS, email, WeChat, custom login, etc.) using client SDKs or HTTP interfaces, as described in the official CloudBase Auth overview documentation.
- Once logged in, CloudBase attaches the user identity and tokens to the environment.
- Node code then reads that identity using the Node SDK, or bridges external identities into CloudBase using custom login.
In practice, Node code usually does one or more of:
Identify the current caller
- In 云函数, use
auth.getUserInfo()to readuid,openId, andcustomUserId. - Use this identity for authorization decisions, logging, and personalisation.
- In 云函数, use
Look up other users
- Use
auth.getEndUserInfo(uid)when you know the CloudBaseuid. - Use
auth.queryUserInfo({ platform, platformId, uid? })when you only have login identifiers such as phone, email, username, or a custom ID.
- Use
Issue custom login tickets
- When you already have your own user system, your Node backend can call
auth.createTicket(customUserId, options)and return the ticket to a trusted client. - The client (typically Web) then uses this ticket with the Web SDK to log the user into CloudBase without forcing them to sign up again.
- When you already have your own user system, your Node backend can call
Log client IP for security
- In 云函数,
auth.getClientIP()returns the caller IP, which you can use for audit logs, anomaly detection, or access control.
- In 云函数,
The scenarios later in this file turn these respons
Установить auth-nodejs-cloudbase в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл auth-nodejs-cloudbase?
Complete guide for CloudBase Auth using the CloudBase Node SDK – caller identity, user lookup, custom login tickets, and server-side best practices.
Как установить скилл auth-nodejs-cloudbase?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл auth-nodejs-cloudbase запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic