redis - 微信网页授权的access_token需要缓存吗?
为情所困
为情所困 2017-04-25 09:04:32
0
3
1067

微信网页授权的access_token虽然有时间限制 也是7200 但是看了官方文档并没有限制调用次数 这个还需要缓存吗?

如果缓存的话 只能根据用户的id来缓存access_token 因为每个用户的access_token不一样 但是 这个用户进来的时候 就需要用这个access_token 后面的逻辑怎么写呢? 还有后面的刷新access_token 还需要按照官方提供的refresh_token进行刷新token吗?

为情所困
为情所困

reply all(3)
PHPzhong

Generally there is no need to cache. The advantage is that you don’t need to flash the authorization page every time you open it. If you cache it, you can write it into the session. When you come in, you can check whether there is an access_token and whether it has expired. If it has expired, you can use refresh_token to refresh it (but I They are all used to jumping directly to the authorization page to authorize again, or they have to judge whether the refresh_token has expired, which is too troublesome logically).

曾经蜡笔没有小新

Unify the statement above and use re-authorization to solve this problem.

巴扎黑

No caching required. There is no limit on the number of times an access_token can be called, only the number of times you can apply for an access_token in a day. .
In addition, I remember that once the access_token is used once, and then the access_token is not used again for a certain period of time, the access_token will become invalid soon. But it’s not stated in the document

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template