Class: OmniAuth::Strategies::WeChat
- Defined in:
- lib/omniauth/strategies/wechat.rb
Instance Method Summary collapse
Methods inherited from OAuth2
Instance Method Details
#authorize_params ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/omniauth/strategies/wechat.rb', line 40 def params = ..merge({ appid: .client_id, redirect_uri: callback_url, response_type: 'code', scope: request.params['scope'] || 'snsapi_login', }) if OmniAuth.config.test_mode @env ||= {} @env["rack.session"] ||= {} end unless .provider_ignores_state params[:state] = SecureRandom.hex(24) session["omniauth.state"] = params[:state] end params end |
#raw_info ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/omniauth/strategies/wechat.rb', line 22 def raw_info @raw_info ||= begin response = access_token.get( '/sns/userinfo', { params: { access_token: access_token.token, openid: access_token['openid'], lang: 'zh-CN' }, parse: :json } ).parsed log :debug, response response end end |
#request_phase ⇒ Object
36 37 38 |
# File 'lib/omniauth/strategies/wechat.rb', line 36 def request_phase redirect client.()+'#wechat_redirect' end |
#token_params ⇒ Object
58 59 60 |
# File 'lib/omniauth/strategies/wechat.rb', line 58 def token_params { appid: .client_id, secret: .client_secret } end |