Codebase list ruby-omniauth-twitter / ba0c9e9
Merge pull request #27 from excid3/master Added force_login option Arun Agrawal 11 years ago
2 changed file(s) with 9 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2626 To use this, just add a querystring for screen_name.
2727
2828 /auth/twitter?screen_name=scottw
29
30 You can also specify ```force_login``` without specifying the screen_name to prompt the user to choose the twitter account they wish to use.
31
32 /auth/twitter?force_login=true
2933
3034 Twitter also optionally supports specifying a x_auth_access_type when authenticating. This is handy when you need to specify special permission in some cases.
3135
3636 alias :old_request_phase :request_phase
3737
3838 def request_phase
39 force_login = session['omniauth.params'] ? session['omniauth.params']['force_login'] : nil
3940 screen_name = session['omniauth.params'] ? session['omniauth.params']['screen_name'] : nil
4041 x_auth_access_type = session['omniauth.params'] ? session['omniauth.params']['x_auth_access_type'] : nil
42 if force_login && !force_login.empty?
43 options[:authorize_params] ||= {}
44 options[:authorize_params].merge!(:force_login => 'true')
45 end
4146 if screen_name && !screen_name.empty?
4247 options[:authorize_params] ||= {}
4348 options[:authorize_params].merge!(:force_login => 'true', :screen_name => screen_name)