by Chi Zhang | v1.0.8
Wechat Login plugin for nativescript. it is forked from with fix for universal link
npm i --save nativescript-wechat-login-knotes

NativeScript WeChat login plugin

npm npm npm

Using this plugin you will be able implement wechat login feature in your APP. You can read more details from here


tns plugin add nativescript-wechat-login-knotes

If you are using NativeScript 5.4.X then you can have a look this branch


If installation was successful then file should be create to your src or app (based on nsconfig.json or webpack.config.js appPath value) directory with your APP ID. If it wasn't successfully created then you will have to create that file manually. You can get code of that file from here. In this case you will require to change YOUR_APP_ID to your app's ID.

If you don't have file in your src or app directory then Android won't receive notification from wechat.


You will have to add in your webpack.config.js file so that android runtime can generate appropriate java class. Check the demo custom-webpack.config.js file. You can read here for details.

If you are using NativeScript version 6.4.0 or newer then you can create custom custom-webpack.config.js file & add that file in your nsconfig.json file as below


const webpackConfig = require("./webpack.config");
const path = require("path");

module.exports = env => {

env = env || {};

const cnf = webpackConfig(env);

env.appComponents = env.appComponents || [];
env.appComponents.push(path.resolve(cnf.context, ""));

const config = webpackConfig(env);

return config;


"webpackConfigPath": "./custom-webpack.config.js"

For NativeScript version 6.3.0 or older edit webpack.config.js manually.

const appComponents = [
resolve(__dirname, "src/") // or resolve(__dirname, "app/") depends on nsconfig.json or webpack.config.js file's appPath value.


Open your Info.plist file from App_Resources/iOS location & add following lines


Change WECHAT_APP_ID with your Wechat App ID. Check demo project demo/App_Resources/iOS/Info.plist


For details you can check the demo project.

In your main.ts or app.ts need to import initWechatSdk(WECHAT_APP_ID, UNIVERSAL_LINK) method with wechat app id.

import { initWechatSdk } from "nativescript-wechat-login-knotes";

initWechatSdk("wxd930ea5d5a258f4f", "");

In any other page

import { WechatLogin } from "nativescript-wechat-login-knotes";
import * as app from "tns-core-modules/application";

Now call in a method

let wechat = new WechatLogin();

if (wechat.isWechatInstalled()) {
} else {
console.log("wechat isn't installed")

You will get response from wxApiResponse event. So, you can register in that event like this:

app.on('wxApiResponse', function(res){
console.dir(res) // you will get wechat notification here.
console.dir(res.object) // information from wechat
}, this);



Apache License Version 2.0, January 2004