Class: OmniAuth::Strategies::Tqq2

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

Instance Method Summary collapse

Instance Method Details

#callback_phaseObject



56
57
58
59
60
61
62
# File 'lib/omniauth/strategies/tqq2.rb', line 56

def callback_phase
  # 伪造防csrf的state,腾讯微博NMMP
  request.params['state'] = session['omniauth.state']
  @openid = request.params["openid"]
  @openkey = request.params["openkey"]
  super
end

#raw_infoObject



64
65
66
67
68
69
70
71
# File 'lib/omniauth/strategies/tqq2.rb', line 64

def raw_info
  @raw_info ||= access_token.get("/api/user/info", params: {
    openid: @openid,
    oauth_consumer_key: access_token.client.id,
    access_token: access_token.token,
    oauth_version: '2.a'
  }, parse: :json).parsed["data"]
end