Class: OmniAuth::Strategies::OpenWechat

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/open_wechat.rb

Instance Method Summary collapse

Instance Method Details

#raw_infoObject



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/omniauth/strategies/open_wechat.rb', line 45

def raw_info
  @uid ||= access_token["openid"]
  @raw_info ||= begin
    access_token.options[:mode] = :query
    if access_token["scope"] && access_token["scope"].include?("snsapi_login")
      @raw_info = access_token.get("/sns/userinfo", :params => {"openid" => @uid}, parse: :json).parsed
    else
      @raw_info = {"openid" => @uid }
    end
  end
end

#request_phaseObject



39
40
41
42
43
# File 'lib/omniauth/strategies/open_wechat.rb', line 39

def request_phase
  params = client.auth_code.authorize_params.merge(redirect_uri: callback_url).merge(authorize_params)
  params["appid"] = params.delete("client_id")
  redirect client.authorize_url(params)
end