Class: OmniAuth::Strategies::Baidu
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Baidu
- Defined in:
- lib/omniauth/strategies/baidu.rb
Instance Method Summary collapse
-
#authorize_params ⇒ Object
You can pass
display
,with_offical_account
orstate
params to the auth request, if you need to set them dynamically. - #raw_info ⇒ Object
Instance Method Details
#authorize_params ⇒ Object
You can pass display
, with_offical_account
or state
params to the auth request, if you need to set them dynamically. You can also set these options in the OmniAuth config :authorize_params option.
/auth/baidu?display=mobile&with_offical_account=1
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/omniauth/strategies/baidu.rb', line 53 def super.tap do |params| %w[display with_offical_account state forcelogin].each do |v| if request.params[v] params[v.to_sym] = request.params[v] # to support omniauth-oauth2's auto csrf protection session['omniauth.state'] = params[:state] if v == 'state' end end end end |
#raw_info ⇒ Object
39 40 41 42 43 44 |
# File 'lib/omniauth/strategies/baidu.rb', line 39 def raw_info access_token.[:mode] = :query access_token.[:param_name] = 'access_token' @uid ||= access_token.get('/rest/2.0/passport/users/getLoggedInUser').parsed["uid"] @raw_info ||= access_token.get("/rest/2.0/passport/users/getInfo", :params => {:uid => @uid}).parsed end |