auth-web-cloudbase

Implements CloudBase Web authentication flows with @cloudbase/js-sdk login methods and user management.

Updated May 14, 2026
One-click install
npx skills add https://github.com/study-yang/Vieb-Coding-- --skill auth-web-cloudbase-study-yang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-web-cloudbase
Source: https://github.com/study-yang/Vieb-Coding--/tree/main/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F-%E5%BF%AB%E8%AE%B0/.codebuddy/skills/auth-web
Command: npx skills add https://github.com/study-yang/Vieb-Coding-- --skill auth-web-cloudbase-study-yang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @cloudbase/js-sdk.

What problem does it solve? Integrating user authentication into Web frontend projects with CloudBase requires knowing the correct SDK methods, provider setup order, and session-checking pitfalls. This Skill provides a concise, practical guide for wiring login, registration, session handling, and user management into Web apps using @cloudbase/js-sdk. ## Core Features & Use Cases - Multiple Login Methods: Phone OTP, email OTP, username/password, anonymous, OAuth (Google/WeChat), custom ticket, and third-party ID token login, all returning Supabase-style { data, error } results. - Reliable Session Guards: Uses auth.getSession() instead of the deprecated getLoginState() to avoid false-positive auth checks caused by accessKey anonymous sessions. - Complete User Management: Sign out, profile updates, password reset, identity linking/unlinking, account deletion, and auth state change listeners. - Use Case: A developer building a React login page with username/password accounts (e.g., admin, editor) uses this Skill to enable the usernamePassword provider via auth-tool, then wires auth.signUp and auth.signInWithPassword directly into the form handlers. ## Quick Start Ask the AI to add CloudBase username and password login to your Web app using @cloudbase/js-sdk after verifying the provider configuration with auth-tool.

Frequently Asked Questions about auth-web-cloudbase

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

FAQPage Schema
How do I add username and password login to a CloudBase Web app?

Enable the usernamePassword provider via manageAppAuth, then call auth.signUp({ username, password }) for registration and auth.signInWithPassword({ username, password }) for login. Both return { data, error }, so check error first.

How to implement phone OTP login with @cloudbase/js-sdk?

Call auth.signInWithOtp({ phone }) to send the SMS code, then call the returned data.verifyOtp({ token }) callback with the user's code to complete login. Enable SMS Login first through the auth-tool provider setup.

Why does my CloudBase route guard pass when no user is logged in?

The deprecated auth.getLoginState() returns an object with a valid uid when the SDK is initialized with accessKey, even without real login. Use auth.getSession() instead, which returns data.session === undefined when no authenticated session exists.

Is CloudBase Web auth compatible with Supabase auth patterns?

Yes, the v2 SDK follows Supabase-style ergonomics: methods return { data, error } and share names like signInWithPassword, signUp, and onAuthStateChange. Key differences are accessKey instead of anonKey and verifyOtp returned as a callback on data.

Can I use this Web auth flow for mini programs or native apps?

No, this flow is only for Web frontend projects using @cloudbase/js-sdk. Mini program auth, native iOS/Android auth, and server-side auth setup require different approaches and are explicitly out of scope.