WeChat Integration
WeChat is a widely used Chinese messaging and social media platform that supports OAuth-based authentication. This guide helps you integrate WeChat as a custom social login provider in your LoginRadius application.
Key Features
-
OAuth 2.0 support for secure login via WeChat
-
Supports both Chinese and International WeChat accounts
-
Custom user data mapping from WeChat to LoginRadius
-
Seamless integration with IDX and JS-based login forms
Use-Cases
-
Enable login for Chinese users via their existing WeChat identity.
-
Onboard verified customers from WeChat Official Accounts.
-
Extend identity coverage to Chinese markets and apps.
-
WeChat can be used as a social login method for global or localized applications.
Configuration
You must follow the below steps to configure Wechat with Loginradius:
- WeChat Setup
- LoginRadius Console Configuration
-
Create a WeChat account via a mobile app
-
Register a Developer Account at https://open.weixin.qq.com
-
Navigate to:
管理中心 (Control Center) > 网站应用 (Website Application)
-
Click
创建网站应用
(Create Website Application) -
During registration, provide the callback URL:
https://<your_app>.hub.loginradius.com
- Once approved, you’ll receive an AppID and AppSecret.
-
Go to Authentication > Custom IDPs, then click Add Custom IDP → Custom OAuth Provider.
-
Enter the following details:
Field | Value |
---|---|
Provider Name | |
User Login Endpoint | https://open.weixin.qq.com/connect/qrconnect |
Access Token Endpoint | China Account: https://api.weixin.qq.com/sns/oauth2/access_token International Account: https://api.wechat.com/sns/oauth2/access_token |
Application Key | Your WeChat AppID |
Application Secret | Your WeChat AppSecret |
Scope | snsapi_login |
Response Type | code |
User Profile Endpoint | China: https://api.weixin.qq.com/sns/userinfo International: https://api.wechat.com/sns/userinfo |
Request Token Method | GET |
Access Token Parameter | access_token |
Data Mapping:
LoginRadius Field | WeChat Field |
---|---|
ID | unionid |
Integration Details
-
Supports account creation and login via WeChat OAuth
-
Only verified WeChat developer accounts can register apps.
-
unionid
acts as the unique identifier from WeChat and is required -
Optional mapping for fields like
nickname
,avatar
, etc., is supported.
Best Practices
-
Use an officially verified WeChat developer account to create an app.
-
Choose the correct API endpoints based on account region (China vs. International)
-
Ensure proper HTTPS callback URL during WeChat app registration.
-
Keep your AppSecret secure.
-
Monitor login success through the LoginRadius logs.