Understanding WeChat OpenID, UnionID, and AppID: A Complete Guide
This article explains how WeChat's Open Platform, Public Platform, and Mini Programs generate and use OpenID, UnionID, and AppID identifiers, illustrates their relationships across multiple accounts and apps, and provides practical advice on storing and migrating these IDs for reliable user authentication.
WeChat is essential for promoting internet applications, so understanding its ecosystem—especially the WeChat Open Platform, Public Platform, Mini Programs, AppID, UnionID, and OpenID—is crucial.
WeChat Public Platform (OpenID)
1. The platform generates an OpenID for each user. 2. Both public accounts and mini programs are managed under the Public Platform; each account (public or mini program) creates a unique OpenID for a user.
Example
A company has three public accounts (A, B, C) and three mini programs (A, B, C). The same WeChat user will receive six distinct OpenID s—one for each platform application.
Public A → User A → OpenID_1 Public B → User A → OpenID_2 Public C → User A → OpenID_3 MiniProgram A → User A → OpenID_4 MiniProgram B → User A → OpenID_5 MiniProgram C → User A → OpenID_6
WeChat Open Platform (UnionID)
1. The Open Platform generates a UnionID for each user. 2. A user has a single UnionID across all applications bound to the same Open Platform account.
Example
A company has three native apps (App_A, App_B, App_C) bound to the same Open Platform account. The same user receives one UnionID but three different OpenID s for the apps.
App_A → User A → OpenID_7 → UnionID_1 App_B → User A → OpenID_8 → UnionID_1 App_C → User A → OpenID_9 → UnionID_1
To share a user across multiple public accounts, mini programs, and apps, bind them to a single Open Platform account. The user will have multiple OpenID s but a single UnionID.
AppID
AppIDuniquely identifies each platform application (public account, mini program, or native app). For example, three public accounts, three mini programs, and three apps each have their own AppID s (AppID_1‑AppID_9).
Public A → AppID_1 → OpenID_1 → UnionID_1 Public B → AppID_2 → OpenID_2 → UnionID_1 Public C → AppID_3 → OpenID_3 → UnionID_1 MiniProgram A → AppID_4 → OpenID_4 → UnionID_1 MiniProgram B → AppID_5 → OpenID_5 → UnionID_1 MiniProgram C → AppID_6 → OpenID_6 → UnionID_1 App A → AppID_7 → OpenID_7 → UnionID_1 App B → AppID_8 → OpenID_8 → UnionID_1 App C → AppID_9 → OpenID_9 → UnionID_1
Key points: AppID identifies the platform application and does not need to be stored as user data. OpenID and UnionID are user data and should be stored.
A single UnionID can serve as the unique user identifier (similar to a userID), while multiple OpenID s distinguish the same user across different apps.
Some SDK APIs still require OpenID as a parameter, and historically OpenID could be obtained without user consent, unlike UnionID.
During Open Platform entity migration, OpenID can be mapped to a new one via the official conversion API.
WeChat Public Account Migration
When migrating a public account to a new entity, you must register a new public account, and the following will change: AppID changes. AppSecret changes. OpenID changes (but can be mapped using the official conversion interface).
After migration, scanning the old QR code redirects to the new account’s follow page.
If the Open Platform entity does not change, UnionID remains unchanged.
WeChat Mini Program Migration
During mini program migration: AppID, AppSecret, and OpenID remain unchanged, so existing QR codes and business logic continue to work.
If the Open Platform entity does not change, UnionID also stays the same.
WeChat Open Platform Migration
When migrating the Open Platform entity, UnionID will change, while AppID, AppSecret, and OpenID stay the same. Since there is no official API for mapping old to new UnionID, developers must handle the mapping themselves. A suggested approach:
Update the WeChat login interface after migration.
When a user logs in via app or mini program, obtain both the old OpenID (unchanged) and the new UnionID.
Search the user table by the new UnionID. If not found, the user may be new or an old user whose UnionID has changed.
Use the OpenID to determine if the user exists; if found, replace the old UnionID with the new one.
If neither identifier matches, treat the user as a new registration and store both OpenID and UnionID.
Conclusion
The article summarizes practical experiences with WeChat Open Platform, Public Platform, Mini Programs, AppID, UnionID, and OpenID, providing clear guidance on their relationships, storage strategies, and migration considerations.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
BaiPing Technology
Official account of the BaiPing app technology team. Dedicated to enhancing human productivity through technology. | DRINK FOR FUN!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
