Skip to main content

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 implementing a client or backend auth flow.

소스 정보

저장소
TencentCloudBase/awesome-cloudbase-examples
최근 소스 활동
2026년 7월 21일 05:51
감지된 SKILL.md 언어
영어
스타
419
포크
282

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
2 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
auth-tool-cloudbase
description
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 implementing a client or backend auth flow.
version
2.24.1
alwaysApply
false
## Standalone Install Note If this environment only installed the current skill, start from the CloudBase main entry and use the published `cloudbase/references/...` paths for sibling skills. - CloudBase main entry: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/SKILL.md` - Current skill raw source: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/auth-tool/SKILL.md` Keep local `references/...` paths for files that ship with the current skill directory. When this file points to a sibling skill such as `auth-tool` or `web-development`, use the standalone fallback URL shown next to that reference. ## Activation Contract ### Use this first when - The task is to inspect, enable, disable, or configure CloudBase auth providers, login methods, publishable key prerequisites, SMS/email delivery, or third-party login readiness. - An auth implementation cannot proceed until provider status and login configuration are confirmed. - A CloudBase Web auth flow needs provider verification before `auth-web`. ### Read before writing code if - The request mentions provider setup, auth console configuration, publishable key retrieval, login method availability, SMS/email sender setup, or third-party provider credentials. - The task mixes provider configuration with Web, mini program, Node, or raw HTTP auth implementation. ### Then also read - Web auth UI -> `../auth-web/SKILL.md` (standalone fallback: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/auth-web/SKILL.md`) - Mini program native auth -> `../auth-wechat/SKILL.md` (standalone fallback: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/auth-wechat/SKILL.md`) - Node server-side identity / custom ticket -> `../auth-nodejs/SKILL.md` (standalone fallback: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/auth-nodejs/SKILL.md`) - Native App / raw HTTP auth client -> `../http-api/SKILL.md` (standalone fallback: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/http-api/SKILL.md`) ### Do NOT use this as - The default implementation guide for every login or registration request. - A replacement for mini program native auth behavior when no provider change is involved. - A replacement for Node-side caller identity, user lookup, or custom login ticket flows. - A replacement for frontend integration, session handling, or client UX implementation. ### Common mistakes / gotchas - Writing login UI before enabling the required provider. - Treating any mention of "auth" as a provider-management task. - Implementing Web login in cloud functions. - Routing native App auth to Web SDK flows. - Making configuration or code changes without first following the Change Safety Protocol (`cloudbase-platform/references/protocols/change-safety-protocol.md`). - In an existing application, looping on provider queries after readiness is already known instead of wiring the active login and register handlers. ### Minimal checklist - Read [Authentication Activation Checklist](checklist.md) before auth implementation. - Anonymous login is disabled by default. The SDK initialized with `accessKey` still creates a lightweight anonymous session for API access. If the app requires authentication (e.g. admin panels, personal dashboards), enforce access control through AuthGuard or RLS policies rather than relying on the login strategy toggle. ## Overview Configure CloudBase authentication providers: Anonymous, Username/Password, SMS, Email, WeChat, Google, and more. **Prerequisites**: CloudBase environment ID (`env`) ## MCP Tool Boundary Keep these two auth domains separate: - `auth`: MCP / management-side login only. Use it for `status`, `start_auth`, `set_env`, `logout`, and `get_temp_credentials`. - `queryAppAuth` / `manageAppAuth`: app-side authentication configuration. Use them for login methods, provider settings, publishable key, static domain, client config, and custom login keys. Preferred execution order for this skill: 1. Use `queryAppAuth` / `manageAppAuth` first when the needed action exists there. 2. Use `callCloudApi` only as a fallback or for debugging raw request shapes. 3. Do not route app-side provider configuration back to the MCP `auth` tool. 4. In existing projects with active login and register handlers, stop revisiting provider setup after the required login method and publishable key are confirmed. Move back to the active frontend handler and finish the actual user flow. --- ## Authentication Scenarios ### 1. Get Login Config Preferred MCP tool path: `queryAppAuth(action="getLoginConfig")` Recommended MCP request: ```json { "action": "getLoginConfig" } ``` `queryAppAuth` uses the currently selected environment and returns a short result by default: ```json { "success": true, "envId": "your-full-env-id", "loginMethods": { "usernamePassword": true, "email": true, "anonymous": false, "phone": false } } ``` Fallback API path: use the official login-config API. Do **not** use `lowcode/DescribeLoginStrategy` or `lowcode/ModifyLoginStrategy` as the default path. Query current login configuration: ```js { "params": { "EnvId": `env` }, "service": "tcb", "action": "DescribeLoginConfig" } ``` The underlying login strategy contains fields such as: - `AnonymousLogin` - `UserNameLogin` - `PhoneNumberLogin` - `EmailLogin` - `SmsVerificationConfig` - `MfaConfig` - `PwdUpdateStrategy` Parameter mapping for downstream Web auth code: - `queryAppAuth(action="getLoginConfig")` and `manageAppAuth(action="patchLoginStrategy")` return `sdkStyle: "supabase-like"` plus `sdkHints`; treat that as the preferred frontend-auth calling guide - `PhoneNumberLogin` controls phone OTP flows used by `auth-web` `auth.signInWithOtp({ phone })` and `auth.signUp({ phone })` - `EmailLogin` controls email OTP flows used by `auth-web` `auth.signInWithOtp({ email })` and `auth.signUp({ email })` - `UserNameLogin` controls username/password Web login flows used by `auth-web` `auth.signInWithPassword({ username, password })`; direct username/password `signUp` support is SDK/provider dependent and must be verified before use - If the account identifier is a plain username string, do not route it through email-only helpers such as `signInWithEmailAndPassword` - `UserNameLogin` also enables the broader password-login surface exposed by `auth.signInWithPassword({ username|email|phone, password })` - `SmsVerificationConfig.Type = "apis"` requires both `Name` and `Method` - `EnvId` is always the CloudBase environment ID, not the publishable key - If the conversation only contains an environment alias, nickname, or other shorthand, resolve it to the canonical full `EnvId` first before generating auth config, SDK init examples, or console links Internal behavior of `manageAppAuth(action="patchLoginStrategy")`: 1. Read the currently selected environment 2. Query the current login strategy 3. Merge the short `patch` into the writable strategy fields 4. Update through Manager SDK 5. Query again and return a short `loginMethods` result --- ### 2. Anonymous Login > ⚠️ **Anonymous login is disabled by default.** The SDK initialized with `accessKey` still creates a lightweight anonymous session for API access. Only enable anonymous login when the application explicitly requires unauthenticated access and you accept the associated security trade-offs. Anonymous users are also denied AI model invocation permissions by default. Preferred MCP tool path: `manageAppAuth(action="patchLoginStrategy")` To explicitly enable anonymous login (only when required): ```json { "action": "patchLoginStrategy", "patch": { "anonymous": true } } ``` The tool handles read-merge-write internally. The model does not need to build a full `ModifyLoginConfig` payload. **Important**: Even after enabling anonymous login, anonymous users cannot call AI models by default. This permission must be explicitly granted separately if needed. --- ### 3. Username/Password Login Preferred MCP tool path: `manageAppAuth(action="patchLoginStrategy")` Recommended MCP request: ```json { "action": "patchLoginStrategy", "patch": { "usernamePassword": true } } ``` The tool handles read-merge-write internally. The model does not need to build a full `ModifyLoginConfig` payload. --- ### 4. SMS Login Preferred MCP tool path: `manageAppAuth(action="patchLoginStrategy")` Use `patch.phone = true/false` for the login method itself. If SMS provider behavior also needs to change, keep using provider-side or raw API configuration for the extra fields such as `SmsVerificationConfig`. Short MCP example: ```json { "action": "patchLoginStrategy", "patch": { "phone": true } } ``` --- ### 5. Email Login Email has two layers of configuration: - `ModifyLoginConfig.EmailLogin`: controls whether email/password login is enabled - `ModifyProvider(Id="email")`: controls the email sender channel and SMTP configuration - In Web auth code, this maps to `auth.signInWithOtp({ email })` and `auth.signUp({ email })` Preferred MCP tool path: - `manageAppAuth(action="patchLoginStrategy")` for `EmailLogin` - `manageAppAuth(action="updateProvider")` for provider settings Short MCP example: ```json { "action": "patchLoginStrategy", "patch": { "email": true } } ``` **Configure email provider (Tencent Cloud email)**: ```js { "params": { "EnvId": `env`, "Id": "email", "On": "TRUE", "EmailConfig": { "On": "TRUE", "SmtpConfig": {} } }, "service": "tcb", "action": "ModifyProvider" } ``` **Disable email provider**: ```js { "params": { "EnvId": `env`, "Id": "email", "On": "FALSE" }, "service": "tcb", "action": "ModifyProvider" } ``` **Configure email provider (custom SMTP)**: ```js { "params": { "EnvId": `env`, "Id": "email", "On": "TRUE", "EmailConfig": { "On": "FALSE", "SmtpConfig": { "AccountPassword": "password", "AccountUsername": "username", "SecurityMode": "SSL", "SenderAddress": "sender@example.com", "ServerHost": "smtp.qq.com", "ServerPort": 465 } } }, "service": "tcb", "action": "ModifyProvider" } ``` --- ### 6. WeChat Login Preferred MCP tool path: - `queryAppAuth(action="listProviders")` or `queryAppAuth(action="getProvider")` - `manageAppAuth(action="updateProvider")` 1. Get WeChat config: ```js { "params": { "EnvId": `env` }, "service": "tcb", "action": "GetProviders" } ``` Filter by `Id == "wx_open"`, save as `WeChatProvider`. 2. Get credentials from [WeChat Open Platform](https://open.weixin.qq.com/cgi-bin/readtemplate?t=regist/regist_tmpl): - `AppID` - `AppSecret` 3. Update: ```js { "params": { "EnvId": `env`, "Id": "wx_open", "On": "TRUE", // "FALSE" to disable "Config": { ...WeChatProvider.Config, ClientId: `AppID`, ClientSecret: `AppSecret` } }, "service": "tcb", "action": "ModifyProvider" } ``` --- ### 7. Google Login Preferred MCP tool path: - `queryAppAuth(action="getStaticDomain")` - `queryAppAuth(action="listProviders")` or `queryAppAuth(action="getProvider")` - `manageAppAuth(action="updateProvider")` 1. Get redirect URI (static hosting CDN domain): ```js { "params": { "EnvId": `env` }, "service": "tcb", "action": "DescribeStaticStore" } ``` Prefer MCP: `queryAppAuth(action="getStaticDomain")` — use `cdnDomain` / `staticDomain` from the tool response (first store’s `CdnDomain`). Raw rows are in `staticStores`. 2. Configure at [Google Cloud Console](https://console.cloud.google.com/apis/credentials): - Create OAuth 2.0 Client ID - Set redirect URI: `https://{staticDomain}/__auth/` - Get `Client ID` and `Client Secret` 3. Enable: ```js { "params": { "EnvId": `env`, "ProviderType": "OAUTH", "Id": "google", "On": "TRUE", // "FALSE" to disable "Name": { "Message": "Google" }, "Description": { "Message": "" }, "Config": { "ClientId": `Client ID`, "ClientSecret": `Client Secret`, "Scope": "email openid profile", "AuthorizationEndpoint": "https://accounts.google.com/o/oauth2/v2/auth", "TokenEndpoint": "https://oauth2.googleapis.com/token", "UserinfoEndpoint": "https://www.googleapis.com/oauth2/v3/userinfo", "TokenEndpointAuthMethod": "CLIENT_SECRET_BASIC", "RequestParametersMap": { "RegisterUserSyncScope": "syncEveryLogin", "IsGoogle": "TRUE" } }, "Picture": "https://qcloudimg.tencent-cloud.cn/raw/f9131c00dcbcbccd5899a449d68da3ba.png", "TransparentMode": "FALSE",
GitHub에서 보기
이 SKILL.md는 매우 커서 SkillsMP가 여기에는 첫 섹션만 미리 보여줍니다. GitHub에서 보기