Commit 559b3626 by lanrion

refactor storage

parent cafe7f50
...@@ -14,8 +14,8 @@ module WeixinAuthorize ...@@ -14,8 +14,8 @@ module WeixinAuthorize
def refresh_token def refresh_token
super super
weixin_redis.hmset(client.redis_key, :access_token, client.access_token, weixin_redis.hmset(client.redis_key, "access_token", client.access_token,
:expired_at, client.expired_at) "expired_at", client.expired_at)
weixin_redis.expireat(client.redis_key, client.expired_at.to_i-10) # 提前10秒超时 weixin_redis.expireat(client.redis_key, client.expired_at.to_i-10) # 提前10秒超时
end end
......
...@@ -55,7 +55,7 @@ module WeixinAuthorize ...@@ -55,7 +55,7 @@ module WeixinAuthorize
end end
def authenticate_headers def authenticate_headers
{grant_type: "client_credential", appid: client.app_id, secret: client.app_secret} {grant_type: GRANT_TYPE, appid: client.app_id, secret: client.app_secret}
end end
private private
...@@ -64,7 +64,7 @@ module WeixinAuthorize ...@@ -64,7 +64,7 @@ module WeixinAuthorize
auth_result = authenticate auth_result = authenticate
if !auth_result["valid"] if !auth_result["valid"]
result_handler = auth_result["handler"] result_handler = auth_result["handler"]
raise ValidAccessTokenException, "#{result_handler.code}:#{result_handler.en_msg}(#{result_handler.cn_msg})" raise ValidAccessTokenException, result_handler.full_error_message
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment