Wechat account login for meteor with support on ios and android.
##Install
meteor add boxfish:accounts-wechat
This package uses Cordova plugin (https://github.com/xu-li/cordova-plugin-wechat) on mobile devices to fetch the authorization code. To use it, the AppId
needs to be set in the mobile.config:
App.configurePlugin('cordova-plugin-wechat', {
WECHATAPPID: '<WECHATAPPID>'
});
- Configure the WeChat service with appId and secret
ServiceConfiguration.configurations.update(
{ "service": "wechat" },
{
$set: {
"service": "wechat",
"appId": <your-app-id>,
"secret": <your-app-secret>
}
},
{ upsert: true } // If doesn't find wechat, insert one
);
- Login using WeChat
Meteor.loginWithWeChat(function (err, res) {
if (err) {
console.log('success ' + res);
}
else {
console.log('login failed ' + err);
}
});