auth-wechat-miniprogram

Installation
Summary

WeChat Mini Program authentication with CloudBase using automatic user identity injection in cloud functions.

  • Automatic authentication: user identity (openid, appid, unionid) is seamlessly injected by WeChat when cloud functions are called, with no explicit login APIs required
  • Initialize CloudBase once in Mini Program entry point with wx.cloud.init(), then retrieve verified user context in cloud functions using cloud.getWXContext()
  • Three user identifiers available: openid (unique per Mini Program), appid (Mini Program identifier), and unionid (optional, for cross-app identification when bound to WeChat Open Platform)
  • Includes four scenario patterns covering Mini Program initialization, retrieving user identity in cloud functions, calling cloud functions from the client, and testing authentication flow
SKILL.md

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-wechat/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 about WeChat Mini Program auth behavior, wx.cloud identity, OPENID / UNIONID, or how a mini program caller is identified in CloudBase.
  • The project is a CloudBase mini program and the auth question is about native mini program identity rather than provider configuration.

Read before writing code if

Related skills

More from tencentcloudbase/skills

Installs
1.6K
GitHub Stars
58
First Seen
Jan 22, 2026