auth-wechat-miniprogram

Initialize CloudBase and retrieve OPENID and UNIONID via cloud.getWXContext.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/derek2035/talkbook --skill auth-wechat-miniprogram-derek2035
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-wechat-miniprogram
Source: https://github.com/derek2035/talkbook/tree/main/.agents/skills/cloudbase/references/auth-wechat
Command: npx skills add https://github.com/derek2035/talkbook --skill auth-wechat-miniprogram-derek2035

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The skill provides native WeChat Mini Program authentication in CloudBase, enabling access to OPENID/UNIONID in cloud functions and automatic caller identity handling without web-based login.

Core Features & Use Cases

  • Native mini program authentication is automatic and seamless within CloudBase.
  • Access user identifiers such as OPENID, APPID, and UNIONID in cloud functions via cloud.getWXContext.
  • Scenarios include initializing CloudBase in a mini program, retrieving user identity in a cloud function, and calling cloud functions from the mini program.

Quick Start

Initialize CloudBase in app.js and use cloud.getWXContext() in cloud functions to obtain OPENID, APPID, and UNIONID.

Frequently Asked Questions about auth-wechat-miniprogram

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

FAQPage Schema
How do I get OPENID in WeChat Mini Program cloud functions?

To get OPENID in WeChat Mini Program cloud functions, call cloud.getWXContext() after initializing CloudBase, which securely returns the caller's OPENID, APPID, and UNIONID without requiring explicit web-based login.

What is the best way to authenticate WeChat Mini Program users in CloudBase?

The best way to authenticate WeChat Mini Program users in CloudBase is using native seamless authentication, which automatically handles caller identity and provides user identifiers directly to cloud functions.

How do I handle UNIONID for cross-app user identification in WeChat?

Handle UNIONID for cross-app user identification by retrieving it via cloud.getWXContext() in cloud functions, checking its availability to securely unify user identity across different WeChat environments.

Can I retrieve user identity in CloudBase without an explicit login flow?

Yes, you can retrieve user identity in CloudBase without an explicit login flow. Native WeChat Mini Program authentication automatically passes user identity context to cloud functions upon initialization.

Why is UNIONID missing from my cloud.getWXContext result?

UNIONID may be missing from cloud.getWXContext if the mini program is not linked to a WeChat Open Platform account, requiring you to handle scenarios where only OPENID is available.

Do I need to initialize CloudBase before calling cloud functions in a mini program?

Yes, you need to initialize CloudBase in app.js before calling cloud functions. This setup enables the seamless authentication flow that passes user identity context to the functions.