Commit 559b3626 by lanrion

refactor storage

parent cafe7f50
......@@ -14,8 +14,8 @@ module WeixinAuthorize
def refresh_token
super
weixin_redis.hmset(client.redis_key, :access_token, client.access_token,
:expired_at, client.expired_at)
weixin_redis.hmset(client.redis_key, "access_token", client.access_token,
"expired_at", client.expired_at)
weixin_redis.expireat(client.redis_key, client.expired_at.to_i-10) # 提前10秒超时
end
......
......@@ -55,7 +55,7 @@ module WeixinAuthorize
end
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
private
......@@ -64,7 +64,7 @@ module WeixinAuthorize
auth_result = authenticate
if !auth_result["valid"]
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
......
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