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
#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 @uid ||= access_token["openid"] @raw_info ||= begin access_token.[:mode] = :query if access_token["scope"] == "snsapi_userinfo" @raw_info = access_token.get("/sns/userinfo", :params => {"openid" => @uid}, parse: :json).parsed else @raw_info = {"openid" => @uid } end end end |
#request_phase ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/omniauth/strategies/wechat.rb', line 38 def request_phase hash_key = request.params['hash_key'] new_callback_url = "#{callback_url}?hash_key=#{hash_key}" params = client.auth_code..merge(redirect_uri: new_callback_url).merge() params["appid"] = params.delete("client_id") redirect client.(params) end |