Class: OmniAuth::Strategies::WeChat
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::WeChat
- Defined in:
- lib/omniauth/strategies/wechat.rb
Instance Method Summary collapse
Instance Method Details
#authorize_params ⇒ Object
17 18 19 20 21 22 |
# File 'lib/omniauth/strategies/wechat.rb', line 17 def params = super params[:state]=request.params['state'] session['omniauth.state'] = params[:state] params.merge({:appid=>.client_id}) end |
#raw_info ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/omniauth/strategies/wechat.rb', line 49 def raw_info @raw_info ||= begin client.request(:get, "https://api.weixin.qq.com/sns/userinfo", :params => { :format => :json, :openid => uid, :oauth_consumer_key => [:client_id], :access_token => access_token.token, :lang =>'zh-CN' }, :parse => :json).parsed end end |
#request_phase ⇒ Object
14 15 16 |
# File 'lib/omniauth/strategies/wechat.rb', line 14 def request_phase redirect client.auth_code.({:redirect_uri => callback_url}.merge())+'#wechat_redirect' end |
#token_params ⇒ Object
24 25 26 27 |
# File 'lib/omniauth/strategies/wechat.rb', line 24 def token_params params = super params.merge({:appid=>.client_id,:secret=>.client_secret}) end |