RootAuth supports using a verified WeChat Official Account as a third-party login and sign-up method. After it is enabled, users can scan a QR code with the WeChat app on a PC login or sign-up page, follow the Official Account, and automatically complete sign-up or login.
Path: Log in to the RootAuth console → open the target application → click Configuration in the top navigation bar → Authentication Configuration → select Providers
1. Before You Start
Before configuring WeChat login, make sure you have completed the following:
- You have a verified WeChat Official Account. WeChat Subscription Accounts are not supported.
- You have obtained the Developer ID (AppID) and Developer Secret (AppSecret) from the WeChat Official Accounts Platform.
- You can configure message push settings, the web authorization domain, and the IP whitelist on the WeChat Official Accounts Platform.
- The annual review of your WeChat Official Account is still valid.
The
access_tokenassociated with the same AppID and AppSecret is globally unique. Requests from multiple servers may overwrite each other. Use one central server to obtain and refresh the token, and let other business servers access it through that service.
2. Enable WeChat in RootAuth
2.1 Enable the WeChat Provider
In the provider list, find WeChat and click Enable.
In the configuration dialog, turn on the WeChat switch at the top. The configuration fields and Save button become available.

2.2 Select a QR Code Generation Method
RootAuth supports two QR code generation methods:
| Method | Description |
|---|---|
| Event QR Code | Uses the WeChat API to generate a QR code with a scene value. When a user scans the code, follow or scan events are sent back to RootAuth. Users who have not followed the Official Account can automatically complete login after following it. This method is selected by default. |
| Web URL QR Code | The QR code contains a WeChat web authorization URL. After scanning, the page opens in WeChat and obtains the OpenID through web authorization. Follow events are not processed. |
2.3 Configure an Event QR Code
If you select Event QR Code, complete the following fields:
| Field | Required | Description |
|---|---|---|
| Developer ID | Yes | The AppID provided by the WeChat Official Accounts Platform. |
| Developer Secret | Yes | The AppSecret provided by the WeChat Official Accounts Platform. |
| Token | Yes | Enter 3-32 letters or numbers. It must match the token in the WeChat message push settings. |
| Callback URL | Generated by RootAuth | Generated for the current application and available to copy. Configure it as the message push URL on the WeChat Official Accounts Platform. |
| QR code validity period | Yes | The QR code validity period in seconds. The default is 600 seconds. An expired QR code is refreshed automatically. |
| IP whitelist | Generated by RootAuth | The RootAuth server IP address. Copy it to the APP IP whitelist on the WeChat Official Accounts Platform. |
| EncodingAESKey | Yes | A 43-character message encryption and decryption key. It must match the WeChat configuration. |
| Official Account annual review date | Yes | Select the annual review date. An expired Official Account may lose API permissions and affect user login. |
| Message encryption mode | Fixed | Fixed to Secure Mode (Recommended). Select the same mode on the WeChat Official Accounts Platform. |
| Login mode | Fixed | Fixed to Available for login and sign-up and cannot be cleared. |


First save the Token, EncodingAESKey, and Callback URL in RootAuth, then configure and save the same values on the WeChat Official Accounts Platform. Otherwise, WeChat may fail to validate the configuration.
2.4 Configure a Web URL QR Code
If you select Web URL QR Code, complete or confirm the following fields:
| Field | Required | Description |
|---|---|---|
| Developer ID | Yes | The AppID provided by the WeChat Official Accounts Platform. |
| Developer Secret | Yes | The AppSecret provided by the WeChat Official Accounts Platform. |
| Domain | Generated by RootAuth | The web authorization domain provided by RootAuth. Copy it to the web authorization domain settings of the WeChat Official Account. |
| IP whitelist | Generated by RootAuth | The RootAuth server IP address. Copy it to the APP IP whitelist on the WeChat Official Accounts Platform. |
| Official Account annual review date | Yes | Select the annual review date. A date before today cannot be selected. |
| Login mode | Fixed | Fixed to Available for login and sign-up and cannot be cleared. |
2.5 Save the Configuration
After completing the fields, click Save. After the configuration is saved:
- The WeChat provider displays the Enabled and WeChat Official Account Follow labels.
- The action button changes to Manage.
- Click Manage to view or update the saved configuration.
3. Configure the WeChat Official Accounts Platform
After saving the RootAuth configuration, complete the corresponding settings on the WeChat Official Accounts Platform.
3.1 Event QR Code
| Step | Setting | Action |
|---|---|---|
| 1 | Server URL | Copy the callback URL provided by RootAuth and configure it as the message push URL on the WeChat Official Accounts Platform. |
| 2 | Token | Enter the same Token configured in RootAuth. |
| 3 | EncodingAESKey | Generate or enter the key on the WeChat Official Accounts Platform and make sure it matches RootAuth. |
| 4 | Message encryption and decryption mode | Select Secure Mode to match the RootAuth setting. |
| 5 | IP whitelist | Add the RootAuth server IP address to the APP IP whitelist on the WeChat Official Accounts Platform. |
3.2 Web URL QR Code
| Step | Setting | Action |
|---|---|---|
| 1 | Web authorization domain | Copy the domain provided by RootAuth and configure it under Account Settings → Function Settings → Web Authorization Domain in the WeChat Official Account backend. |
| 2 | IP whitelist | Add the RootAuth server IP address to the APP IP whitelist on the WeChat Official Accounts Platform. |
4. How Users Log In with WeChat
4.1 Hosted Integration
When you use the login and sign-up pages hosted by RootAuth, enabling WeChat adds a WeChat entry to the third-party login area. Clicking it opens a WeChat QR code dialog.
If Google, Facebook, WeChat, and other third-party providers are enabled at the same time, the entries are displayed in the configured order. If some providers are collapsed, WeChat may appear under More Login Options or More Sign-Up Options.
4.2 Scan to Log In or Sign Up
- The user clicks the WeChat entry on the login or sign-up page.
- A QR code dialog opens, and the user scans the code with the WeChat app.
- For an Event QR Code, a user who has not followed the Official Account must follow it first.
- RootAuth uses the WeChat user identifier to find an associated account.
- If an account exists, RootAuth logs the user in. If no account exists, RootAuth creates an account and completes login.
- After login succeeds, the QR code dialog closes and the page redirects to the application callback URL.
Whether the user scans from the login page, sign-up page, or unified login/sign-up page, RootAuth automatically completes login or sign-up based on whether an account already exists.


4.3 API Integration
If your application uses a custom frontend, use the RootAuth API to implement the WeChat QR code entry. A typical flow includes:
- Request a WeChat QR code with a scene value.
- Poll or query the scan status.
- After a successful scan, obtain the user information and login session.
With API integration, your application is responsible for displaying the QR code, showing loading states, refreshing expired codes, and redirecting after successful login.
5. View a User's WeChat Authentication Method
5.1 View User Records
After a user signs up by scanning a WeChat QR code, RootAuth creates a user record. If WeChat does not return an email address or phone number, the corresponding fields in the user list remain empty.
Administrators can go to User Management → Users, open the user details, and add an email address, phone number, or other basic information.
5.2 View the Authentication Method
On the user details page, check the Authentication Methods section for the WeChat Official Account Follow record.
| Field | Description |
|---|---|
| Authentication method | WeChat Official Account Follow |
| Identifier | The WeChat user identifier associated with the current user, such as OpenID. |
| Last used | The most recent time the user logged in through the WeChat Official Account. |
6. Bind or Unbind a WeChat Account
WeChat QR code login creates a new user when no associated account is found. To associate the WeChat identity with an existing account, the application must call the RootAuth API after the user has logged in.
- Bind: The logged-in user submits the WeChat authorization result, and the application calls the RootAuth API to associate the WeChat identity with the current account.
- Unbind: The logged-in user requests unbinding, and the application calls the RootAuth API to remove the WeChat binding from the current account.
- One WeChat account can be associated with only one system account.
The RootAuth console does not provide buttons for administrators to bind or unbind WeChat accounts manually. The application must implement the binding and unbinding flows.
7. Logs
RootAuth records WeChat-related actions under Audit Logs → User Behavior Logs.
| Event type | Description |
|---|---|
| WeChat Official Account sign-up | The user creates an account by scanning a WeChat QR code. |
| WeChat Official Account login | The user logs in to an existing account by scanning a WeChat QR code. |
| Bind WeChat Official Account | A logged-in user binds a WeChat Official Account through the application. |
| Unbind WeChat Official Account | A logged-in user unbinds a WeChat Official Account through the application. |
Logs include the user, IP address, country, time, result, and failure reason. For a newly registered user without an email address or phone number, the user field may display the user ID. After the identity is bound to an existing account, the email address or phone number is displayed first.
8. Disable WeChat Login
To disable WeChat login, click Manage for WeChat, turn off the switch at the top of the dialog, and save.
After WeChat login is disabled:
- The Hosted login and sign-up pages no longer display the WeChat entry.
- The saved AppID, AppSecret, and other settings are retained for future use.
- Existing users' WeChat authentication records are not deleted.
- After enabling it again, you can update and save the configuration. The new configuration replaces the previous settings.