-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
关于API_TOKEN_REFRESH #20
Comments
@zsj1029 这块确实没实现,现在有这么一个问题: 一个 openid 对应一组:access_token + refresh_token,所以如果缓存的话,这套逻辑没想到怎么一个比较优雅的实现。 目前有这么一个想法不知道你们觉得怎么样?
$user = $auth->authorize(); 此时你把user信息写入到你的数组库中,同时获取 下次进来的时候,因为已经授权过嘛,你可以从数据库取出 $res = $auth->refresh($refreshToken); // $refreshToken 为该用户的$refreshToken
$user = $auth->getUser($openId, $res['access_token']); // 使用刷新后的access_token得到用户信息 $res 包含以下信息: {
"access_token":"ACCESS_TOKEN",
"expires_in":7200,
"refresh_token":"REFRESH_TOKEN",
"openid":"OPENID",
"scope":"SCOPE",
"unionid": "o6_bmasdasdsad6_2sgVt7hMZOPfL"
} 刷新后把 不知道上面的这样是否能接受?如果OK的话我就提交代码。 |
我记得微信有个 检验授权凭证(access_token)是否有效 |
我建议,你把基础方法都写好,逻辑让开发自己处理 |
通过refresh_token重新获取用户access_token,auth.php没做实现吗?
有一种业务场景:
1、用户一个月前网页授权过了,我这也存了用户的性别、昵称等等
2、用户最近更改了微信昵称,他发现我的网站个人信息页面昵称还是以前的
这种情况我想重新获取用户信息,按照auth逻辑,是不是要重新让用户跳转授权页面确认
而不是通过refresh_token重新获取用户access_token,然后自动获取最新的用户信息
The text was updated successfully, but these errors were encountered: