登录授权

auth方法用来唤起微信客户端进行授权登录。

微信官方文档

参数说明

参数名 参数类型 是否必须 说明
scope string 授权域
state string 标识符唯一即可

示例代码

var scope = "snsapi_userinfo",
    state = "_" + (+new Date());

Wechat.auth(function (installed) {
    alert("Wechat installed: " + (installed ? "Yes" : "No"));
}, function (reason) {
    alert("Failed: " + reason);
});