new WeChatAdapter(options)
Parse Server Configuration
To configure Parse Server for WeChat authentication, use the following structure:
Secure Configuration (Recommended)
{
"auth": {
"wechat": {
"clientId": "your-client-id",
"clientSecret": "your-client-secret"
}
}
}
Insecure Configuration (Not Recommended)
{
"auth": {
"wechat": {
"enableInsecureAuth": true
}
}
}
The adapter requires the following authData fields:
- With
enableInsecureAuth(Not Recommended):id,access_token. - Without
enableInsecureAuth:code.
Auth Payloads
Secure Authentication Payload (Recommended)
{
"wechat": {
"code": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
Insecure Authentication Payload (Not Recommended)
{
"wechat": {
"id": "1234567",
"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
Notes
- With
enableInsecureAuth, the adapter directly validates theidandaccess_tokensent by the client. - Without
enableInsecureAuth, the adapter uses thecodeprovided by the client to exchange for an access token via WeChat's OAuth API. - The
enableInsecureAuthflag is deprecated and may be removed in future versions. Use secure authentication with thecodefield instead.
Parameters:
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object | The adapter options object. Properties
|
Example
Auth Data Example
// Example authData provided by the client:
const authData = {
wechat: {
code: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
};