wechat-oauth icon indicating copy to clipboard operation
wechat-oauth copied to clipboard

Wechat OAuth

Results 11 wechat-oauth issues
Sort by recently updated
recently updated
newest added

oauth.js26行的判断代码如下: ```javascript return !!this.data.access_token && (new Date().getTime()) < (this.data.create_at + this.data.expires_in * 1000); ``` (this.data.create_at + this.data.expires_in * 1000)这个代码在字符和数字时表现出来的结果是不一样的。

新版的小程序接口encryptedData中不包含openid和unionid了,在code2session接口中获取

需要最新iPAD协议联系(v:ixiaohe_)

要bind this,要不然,里边的this 指向的是oAuth ``` new OAuth(app.appid, app.secret, ctx.service.wechat.getToken.bind(this), ctx.service.wechat.setToken.bind(this), true); ``` // service/wechatToken.js ``` async getToken(openid) { const res = await this.ctx.model.WechatToken.findOne({ openid }); return res; } async setToken(openid, token)...

获取到code后,请求getAccessToken时报错跨域

https://open.wechat.com/cgi-bin/newreadtemplate?t=overseas_open/docs/web/login/login#-parameters- According to above document, there are `style`, `href` parameters on `qrconnect` authorization page. But I can't find an option to pass these parameters.

` get_redrict:function (req,res) { console.log(req.query.code); client.getAccessToken(req.query.code, function (err, result) { console.log(req.query.code); var accessToken = result.data.access_token; var openid = result.data.openid; client.getUser(openid, function (err, user) { console.log(user) }); }); }, ` 第一个console.log(req.query.code);能打印,之后旧没反应了

access_token 最新获得的长度已经是109了, 如果还用107会遇到access_token无效的问题 弄成512比较保险

修复非静默授权bug,成功获取用户信息后,err会返回ok