Module: ThirdPartyWxa::Api::Authorize
- Included in:
- Plugin
- Defined in:
- lib/third_party_wxa/api/authorize.rb
Instance Method Summary collapse
- #authorizer_access_token_api(auth_code) ⇒ Object
-
#authorizer_access_token_fresh(auth_appid, refresh_token) ⇒ Object
https:// api.weixin.qq.com /cgi-bin/component/api_authorizer_token?component_access_token=xxxxx.
- #bindcomponent(redirect, type = 2) ⇒ Object
- #component_access_token_api ⇒ Object
- #componentloginpage_url(redirect, sign, type = 2) ⇒ Object
-
#pre_auth_code_api ⇒ Object
通过component_access_token获取pre_auth_code api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=xxx.
Instance Method Details
#authorizer_access_token_api(auth_code) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/third_party_wxa/api/authorize.rb', line 33 def (auth_code) params = {component_appid: appid, authorization_code: auth_code} ThirdPartyWxa.http_post_without_component_access_token 'cgi-bin', 'component/api_query_auth', params, {component_access_token: get_component_access_token} end |
#authorizer_access_token_fresh(auth_appid, refresh_token) ⇒ Object
https:// api.weixin.qq.com /cgi-bin/component/api_authorizer_token?component_access_token=xxxxx
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/third_party_wxa/api/authorize.rb', line 42 def auth_appid, refresh_token params = { "component_appid": appid, "authorizer_appid": auth_appid, "authorizer_refresh_token": refresh_token, } ThirdPartyWxa.http_post_without_component_access_token 'cgi-bin', 'component/api_authorizer_token', params, {component_access_token: get_component_access_token} end |
#bindcomponent(redirect, type = 2) ⇒ Object
29 30 31 |
# File 'lib/third_party_wxa/api/authorize.rb', line 29 def bindcomponent redirect, type=2 "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=#{type}&no_scan=1&component_appid=#{appid}&pre_auth_code=#{get_pre_auth_code}&redirect_uri=#{redirect}&auth_type=#{type}#wechat_redirect" end |
#component_access_token_api ⇒ Object
6 7 8 9 10 11 |
# File 'lib/third_party_wxa/api/authorize.rb', line 6 def component_access_token_api params = {component_appid: appid, component_appsecret: appsecret, component_verify_ticket: component_verify_ticket} ThirdPartyWxa.http_post_without_component_access_token 'cgi-bin', 'component/api_component_token', params end |
#componentloginpage_url(redirect, sign, type = 2) ⇒ Object
24 25 26 27 |
# File 'lib/third_party_wxa/api/authorize.rb', line 24 def componentloginpage_url redirect, sign, type=2 redirect_uri = "#{redirect}?sign=#{sign}" "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=#{appid}&pre_auth_code=#{get_pre_auth_code}&auth_type=#{type}&redirect_uri=#{redirect_uri}" end |
#pre_auth_code_api ⇒ Object
通过component_access_token获取pre_auth_code api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=xxx
16 17 18 19 20 21 22 |
# File 'lib/third_party_wxa/api/authorize.rb', line 16 def pre_auth_code_api params = {component_appid: appid} ThirdPartyWxa.http_post_without_component_access_token 'cgi-bin', 'component/api_create_preauthcode', params, {component_access_token: get_component_access_token} end |