Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信内置浏览器页面刷新问题 #36

Closed
LincolnBurrows opened this issue Jul 31, 2017 · 3 comments
Closed

微信内置浏览器页面刷新问题 #36

LincolnBurrows opened this issue Jul 31, 2017 · 3 comments

Comments

@LincolnBurrows
Copy link

client.getAccessToken('code', function (err, result) {
  var accessToken = result.data.access_token;
  var openid = result.data.openid;
});

微信内置浏览器页面刷新,code已经使用过,result不包括data属性
示例:

{"errcode":40163,"errmsg":"code been used, hints: [ req_id: KNJZqa0152th52 ]"}
@JacksonTian
Copy link
Member

自己要做 code 的缓存。

@LincolnBurrows
Copy link
Author

应该是需要重新获取新的code吧

@JacksonTian
Copy link
Member

不需要。服务端判断当前 code 是否是之前一段时间内使用过,如果是,从缓存读取数据。

简单点来说就是 code 用过之后要把数据保存在 session 中。第二次进入就直接用 session 中的数据。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants