auth-nodejs-cloudbase

Authenticate CloudBase Node.js backends by identifying callers and resolving user data.

Updated Dec 8, 2025
One-click install
npx skills add https://github.com/sycsky/Soncho --skill auth-nodejs-cloudbase-sycsky
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-nodejs-cloudbase
Source: https://github.com/sycsky/Soncho/tree/main/.codebuddy/rules/tcb/rules/auth-nodejs-skill
Command: npx skills add https://github.com/sycsky/Soncho --skill auth-nodejs-cloudbase-sycsky

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Authenticate and authorize CloudBase Node.js backends by identifying the caller and resolving user data.

Core Features & Use Cases

  • Identify the current caller with auth.getUserInfo() to obtain uid, openId, appId, and customUserId for authorization decisions.
  • Retrieve full end-user profiles using auth.getEndUserInfo(uid?) and auth.queryUserInfo(...) for admin lookups and rich user data.
  • Bridge existing user systems with custom login tickets via auth.createTicket(...) for seamless CloudBase logins.
  • Access client IP for security logging with auth.getClientIP() in CloudBase functions.
  • Real-world: backend services validate requests by inspecting the caller's uid and roles before performing sensitive operations.

Quick Start

Initialize the CloudBase Node SDK in your function and start using the auth APIs to identify callers and perform lookups.

Frequently Asked Questions about auth-nodejs-cloudbase

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I authenticate CloudBase Node.js backend requests and identify the caller?

To authenticate CloudBase Node.js backends, call auth.getUserInfo() to identify the current caller and obtain their uid, openId, and appId for secure server-side authorization decisions.

How do I retrieve full user profiles for admin lookups in CloudBase functions?

Retrieve full end-user profiles in CloudBase functions using auth.getEndUserInfo() for specific users or auth.queryUserInfo() to perform comprehensive admin lookups and resolve rich user data.

Can I bridge an existing user system with custom login tickets in CloudBase?

Yes, you can bridge existing user systems by generating custom login tickets via auth.createTicket(), enabling seamless CloudBase logins for your already authenticated users.

What is the best way to log the client IP for security in CloudBase Node services?

The best way to log client IP for security in CloudBase Node services is using the auth.getClientIP() method, which extracts the caller's IP address directly within your server-side functions.

Does CloudBase Node SDK authentication work for long-running Node services?

Yes, CloudBase Node SDK authentication works for both cloud functions and long-running Node services to identify callers, look up users, and issue custom login tickets securely.

Why validate caller uid and roles before performing sensitive operations in CloudBase?

Validating caller uid and roles before sensitive operations prevents unauthorized access, using auth.getUserInfo() data to ensure backend services only execute permitted actions for verified users.