Class: Wechat::Core::AccessToken
- Inherits:
-
Object
- Object
- Wechat::Core::AccessToken
- Defined in:
- lib/wechat/core/access_token.rb
Class Method Summary collapse
-
.load(app_id, app_secret) ⇒ Object
获取 Access Token mp.weixin.qq.com/wiki/11/0e4b294685f817b95cbed85ba5e82b8f.html.
Class Method Details
.load(app_id, app_secret) ⇒ Object
获取 Access Token mp.weixin.qq.com/wiki/11/0e4b294685f817b95cbed85ba5e82b8f.html
Return hash format if success:
access_token: <ACCESS_TOKEN>,
expires_in: 7200
The ACCESS_TOKEN is 107 characters in 2015.
14 15 16 17 18 19 20 21 22 |
# File 'lib/wechat/core/access_token.rb', line 14 def self.load(app_id, app_secret) = ::JSONClient.new.get 'https://api.weixin.qq.com/cgi-bin/token', { grant_type: 'client_credential', appid: app_id, # Rails.application.secrets.wechat_app_id, secret: app_secret, # Rails.application.secrets.wechat_app_secret } .body end |