Community程式設計與開發github.com

tencentcloudbase/auth-wechat-miniprogram

CloudBase 微信小程序原生認證指南。當用戶需要小程式身份處理、獲取 OPENID/UNIONID,或是在專案中使用 `wx.cloud` 原生自動登入行為時,應使用此技能。

auth-wechat-miniprogram 是什麼?

此技能為開發者提供 CloudBase 微信小程序原生認證的完整指南。它涵蓋如何在小程式中透過 CloudBase SDK 自動獲取用戶身份(OPENID/UNIONID),並處理無感登入流程。技能支援 `wx.cloud` 原生登入方式,適合需要後端資源存取或身份綁定的場景。通過此技能,開發者可以快速整合身分驗證,減少手動處理登入 token 的複雜度。它適用於所有基於微信小程式的 CloudBase 專案,並提供清晰的文件說明。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/tencentcloudbase/skills/tree/main/skills/auth-wechat-miniprogram

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

auth-wechat-miniprogram 是做什麼的?

CloudBase 微信小程序原生認證指南。當用戶需要小程式身份處理、獲取 OPENID/UNIONID,或是在專案中使用 wx.cloud 原生自動登入行為時,應使用此技能。

概述

此技能專注於 CloudBase 與微信小程式的原生認證整合,提供自動化的用戶身份獲取流程。透過 wx.cloud 介面,開發者可以無需手動實作登入邏輯,即可在後端取得用戶的唯一識別碼。

使用場景

  • 需要取得用戶 OPENID 或 UNIONID 進行身份綁定
  • 專案中使用 wx.cloud 原生登入方式
  • 需要無感自動登入,減少用戶操作步驟

設定步驟

  1. 確認已經啟用 CloudBase 環境,並在小程式後台設定 CloudBase 相關配置。

  2. 在專案中引入 CloudBase SDK:

    const cloud = require('wx-server-sdk')
    cloud.init({
      env: 'your-env-id'
    })
    
  3. 呼叫 wx.cloud 初始化小程式端 SDK:

    wx.cloud.init({
      env: 'your-env-id'
    })
    
  4. 使用雲函數或資料庫操作時,系統會自動獲取用戶身份。

注意事項

  • 確保小程式已獲得用戶授權(如 scope.userInfo)以取得 UNIONID。
  • 若用戶拒絕授權,需手動處理降級方案。

參考資源

Individual skills in this repo

This repo contains 8 individual skills — each has its own dedicated page.

tencentcloudbase/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), or custom-*. Model IDs (deepseek-v4-flash, deepseek-v3.2, hunyuan-2.0-instruct-20251111, glm-5, kimi-k2.6) go in the data wrapper model field. API differs from JS/Node SDK — streamText needs data wrapper, generateText returns raw response. MUST run two-step preflight before code — see body. Keywords: Mini Program AI, wx.cloud.extend.AI, 小程序成长计划, ai_miniprogram_inspire_plan, Token Credits 资源包, generateText, streamText, createModel, hunyuan-exp, TokenHub, Hunyuan, DeepSeek, GLM, Kimi, MiniMax. NOT for browser/Web (use ai-model-web), Node.js backend (use ai-model-nodejs), or image generation (use ai-model-nodejs).

tencentcloudbase/cloudbase-document-database-in-wechat-miniprog

Use CloudBase document database WeChat MiniProgram SDK to query, create, update, and delete data. Supports complex queries, pagination, aggregation, and geolocation queries.

tencentcloudbase/cloudbase-platform

CloudBase platform overview and routing guide. This skill should be used when users need high-level capability selection, platform concepts, console navigation, or cross-platform best practices before choosing a more specific implementation skill.

tencentcloudbase/cloud-functions

CloudBase function runtime guide for building, deploying, and debugging your own Event Functions or HTTP Functions. This skill should be used when users need application runtime code on CloudBase, not when they are merely calling CloudBase official platform APIs.

tencentcloudbase/miniprogram-development

WeChat Mini Program development skill for building, debugging, previewing, testing, publishing, and optimizing mini program projects. This skill should be used when users ask to create, develop, modify, debug, preview, test, deploy, publish, launch, review, or optimize WeChat Mini Programs, mini program pages, components, `tabBar`, routing, navigation, icon assets, project structure, project configuration, `project.config.json`, `appid` setup, device preview, real-device validation, WeChat Developer Tools workflows, `miniprogram-ci` preview/upload flows, or mini program release processes. It should also be used when users explicitly mention CloudBase, `wx.cloud`, Tencent CloudBase, 腾讯云开发, or 云开发 in a mini program project.

tencentcloudbase/spec-workflow

Use when medium-to-large changes need explicit requirements, technical design, and task planning before implementation, especially for multi-module work, unclear acceptance criteria, or architecture-heavy requests.

tencentcloudbase/ui-design

Use when users need visual direction, interface hierarchy, layout decisions, design specifications, or prototypes before implementing a Web or mini program UI.

tencentcloudbase/web-development

Use when users need to implement, integrate, debug, build, deploy, or validate a Web frontend after the product direction is already clear, especially for React, Vue, Vite, browser flows, or CloudBase Web integration.

相關技能