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

修正不能真正保持token的bug #36

Closed
wants to merge 1 commit into from

Conversation

zyxstar
Copy link

@zyxstar zyxstar commented Jul 9, 2015

因为@token_data ||= JSON.parse(File.read(token_file))需要json格式的文件,但在client.get时已被转换成hash对象了,写入临时文件时,也是hash后的字符串,导致每次JSON.parse时发生异常,直接再次从服务器直接获取了

因为`@token_data ||= JSON.parse(File.read(token_file))`需要json格式的文件,但在`client.get`时已被转换成hash对象了,写入临时文件时,也是hash后的字符串,导致每次`JSON.parse`时发生异常,直接再次从服务器直接获取了
@xuyao91
Copy link

xuyao91 commented Jul 24, 2015

请问一下,他是在哪判断access_token是否过期的???

@zyxstar
Copy link
Author

zyxstar commented Aug 7, 2015

@xuyao91 他没有判断过期,只是一直带着tmp下缓存的token去访问,当出现42001, 40014 时就抛出AccessTokenExpiredError ,然后上层捕获该错误,重新取得token,并retry

ps,根据现在的微信文档,发现错误码40001也应当抛出AccessTokenExpiredError

@xuyao91
Copy link

xuyao91 commented Aug 7, 2015

@zyxstar 这样做不好吧,还是要有一个处理过期的机制,看了一下其它的这种Gem,都有过期处理。

@Eric-Guo
Copy link
Owner

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

Successfully merging this pull request may close these issues.

3 participants