/auth-nodejs-cloudbase
CloudBase Node SDK auth guide for server-side identity, user lookup, and custom login tickets. This skill should be used when Node.js code must read caller identity, inspect end users, or bridge an existing user system into CloudBase; not when configuring providers or building
$ npx -y skills add TencentCloudBase/CloudBase-AI-Toolkit --skill auth-nodejs-cloudbase --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/auth-nodejs-cloudbase
Context preview
The summary Claude sees to decide when to auto-load this skill.
CloudBase Node SDK auth guide for server-side identity, user lookup, and custom login tickets. This skill should be used when Node.js code must read caller identity, inspect end users, or bridge an existing user system into CloudBase; not when configuring providers or building
SKILL.md
auth-nodejs-cloudbase.SKILL.mdname: auth-nodejs-cloudbase
description: CloudBase Node SDK auth guide for server-side identity, user lookup, and custom login tickets. This skill should be used when Node.js code must read caller identity, inspect end users, or bridge an existing user system into CloudBase; not when configuring providers or building client login UI.
version: 2.26.0
alwaysApply: false
Sibling skills (local only)
Sibling CloudBase skills ship beside this skill. Use local relative paths such as `../auth-tool-cloudbase/SKILL.md`.
If a referenced sibling skill file is missing from this environment, ask the user to install the full CloudBase plugin (or the missing skill). Do **not** HTTP-fetch remote skill or protocol markdown into the agent context.
Activation Contract
Use this first when
- Node.js code in cloud functions or backend services must read caller identity, look up users, or issue custom login tickets.
- The backend responsibility is auth / identity, not provider setup or frontend login UI.
Read before writing code if
- The task mentions `@cloudbase/node-sdk`, server-side auth, custom login tickets, or "who is calling".
- The request mixes frontend login with backend identity logic; split the flow and route client-side work elsewhere.
Then also read
- Provider setup / publishable key -> `../auth-tool-cloudbase/SKILL.md`
- Web login UI that consumes custom tickets -> `../auth-web-cloudbase/SKILL.md`
- Raw HTTP auth client -> `../http-api-cloudbase/SKILL.md`
Do NOT use for
- Provider enable/disable or login console configuration.
- Frontend login / sign-up UI.
- Mini program native auth.
Common mistakes / gotchas
- Using this skill as the entry point for every auth request.
- Mixing provider-management work with Node-side identity code.
- Reaching for raw HTTP examples when Node SDK already covers the job.
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:
1. **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?
2. **Confirm CloudBase environment and SDK**
- Ask for:
- `env` – CloudBase environment ID
- Install the latest `@cloudbase/node-sdk` from 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();3. **Pick the relevant scenario from this file**
- For **caller identity inside a function**, use the `getUserInfo` scenarios.
- For **full user profile or admin lookup**, use the `getEndUserInfo` and `queryUserInfo` scenarios.
- For **client systems that already have their own users**, use the **custom login ticket** scenarios built on `createTicket`.
- For **logging / security**, use the `getClientIP` scenario.
4. **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.
5. **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 separates **where users log in** from **where backend code runs**:
- Users log in through the supported auth methods (username/password, SMS, email, WeChat, custom login, anonymous — disabled by default, 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:
1. **Identify the current caller**
- In 云函数, use `auth.getUserInfo()` to read `uid`, `openId`, and `customUser
Read more
name: auth-nodejs-cloudbase description: CloudBase Node SDK auth guide for server-side identity, user lookup, and custom login tickets. This skill should be used when Node.js code must read caller identity, inspect end users, or bridge an existing user system into CloudBase; not when configuring providers or building client login UI. version: 2.26.0 alwaysApply: false
Sibling skills (local only)
Sibling CloudBase skills ship beside this skill. Use local relative paths such as `../auth-tool-cloudbase/SKILL.md`.
If a referenced sibling skill file is missing from this environment, ask the user to install the full CloudBase plugin (or the missing skill). Do **not** HTTP-fetch remote skill or protocol markdown into the agent context.
Activation Contract
Use this first when
- Node.js code in cloud functions or backend services must read caller identity, look up users, or issue custom login tickets.
- The backend responsibility is auth / identity, not provider setup or frontend login UI.
Read before writing code if
- The task mentions `@cloudbase/node-sdk`, server-side auth, custom login tickets, or "who is calling".
- The request mixes frontend login with backend identity logic; split the flow and route client-side work elsewhere.
Then also read
- Provider setup / publishable key -> `../auth-tool-cloudbase/SKILL.md`
- Web login UI that consumes custom tickets -> `../auth-web-cloudbase/SKILL.md`
- Raw HTTP auth client -> `../http-api-cloudbase/SKILL.md`
Do NOT use for
- Provider enable/disable or login console configuration.
- Frontend login / sign-up UI.
- Mini program native auth.
Common mistakes / gotchas
- Using this skill as the entry point for every auth request.
- Mixing provider-management work with Node-side identity code.
- Reaching for raw HTTP examples when Node SDK already covers the job.
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:
1. **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?
2. **Confirm CloudBase environment and SDK**
- Ask for:
- `env` – CloudBase environment ID
- Install the latest `@cloudbase/node-sdk` from 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();3. **Pick the relevant scenario from this file**
- For **caller identity inside a function**, use the `getUserInfo` scenarios.
- For **full user profile or admin lookup**, use the `getEndUserInfo` and `queryUserInfo` scenarios.
- For **client systems that already have their own users**, use the **custom login ticket** scenarios built on `createTicket`.
- For **logging / security**, use the `getClientIP` scenario.
4. **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.
5. **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 separates **where users log in** from **where backend code runs**:
- Users log in through the supported auth methods (username/password, SMS, email, WeChat, custom login, anonymous — disabled by default, 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:
1. **Identify the current caller**
- In 云函数, use `auth.getUserInfo()` to read `uid`, `openId`, and `customUser
AI writes the code. CloudBase runs the backend. The CloudBase integration layer for AI coding tools: Plugin installs the stack, Skills steer how code is written, MCP operates databases, functions, storage, and deploys from chat.
Repo: TencentCloudBase/CloudBase-AI-Toolkit
Other skills on cloudbase-ai-toolkit.
- /ai-model-nodejs
Use this skill for Node.js backend AI via @cloudbase/node-sdk (>=3.16.0) — cloud functions, CloudRun, Express, Koa, NestJS, serverless APIs, scheduled jobs, LLM proxies. Only SDK supporting image generation (ai.createImageModel + generateImage). Text models via ai.createModel
Open skill - /ai-model-web
Use this skill when a browser/Web app (React, Vue, Angular, Next, Nuxt, static sites, SPAs, dashboards, AI chat UI) needs AI models via @cloudbase/js-sdk. Default routing for page/页面/Web/前端/frontend/网页/H5 AI — call directly from browser, do NOT propose a Node.js proxy. Covers
Open skill - /ai-model-wechat
Use this skill for WeChat Mini Program AI via wx.cloud.extend.AI (小程序, 企业微信小程序, wx.cloud apps). Features generateText and streamText with callbacks (onText, onEvent, onFinish). Models via wx.cloud.extend.AI.createModel with groups hunyuan-exp (小程序成长计划), cloudbase (main managed),
Open skill - /auth-tool-cloudbase
CloudBase auth provider configuration and login-readiness guide. This skill should be used when users need to inspect, enable, disable, or configure auth providers, publishable-key prerequisites, login methods, SMS/email sender setup, or other provider-side readiness before
Open skill - /auth-web-cloudbase
CloudBase Web Authentication Quick Guide for frontend integration after auth-tool has already been checked. Provides concise and practical Web authentication solutions with multiple login methods and complete user management.
Open skill - /auth-wechat-miniprogram
CloudBase WeChat Mini Program native authentication guide. This skill should be used when users need mini program identity handling, OPENID/UNIONID access, or `wx.cloud` auth behavior in projects where login is native and automatic.
Open skill

