Class: OmniAuth::Strategies::Exvo
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Exvo
- Defined in:
- lib/omniauth/strategies/exvo.rb
Instance Method Summary collapse
- #callback_key ⇒ Object
- #callback_phase ⇒ Object
- #callback_url ⇒ Object
- #interactive? ⇒ Boolean
- #non_interactive? ⇒ Boolean
- #raw_info ⇒ Object
- #request_phase ⇒ Object
- #set_failure_handler ⇒ Object
Instance Method Details
#callback_key ⇒ Object
26 27 28 |
# File 'lib/omniauth/strategies/exvo.rb', line 26 def callback_key '_callback' end |
#callback_phase ⇒ Object
21 22 23 24 |
# File 'lib/omniauth/strategies/exvo.rb', line 21 def callback_phase set_failure_handler super end |
#callback_url ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/omniauth/strategies/exvo.rb', line 30 def callback_url if interactive? super else super + "?" + Rack::Utils.build_query(callback_key => request[callback_key]) end end |
#interactive? ⇒ Boolean
38 39 40 |
# File 'lib/omniauth/strategies/exvo.rb', line 38 def interactive? !non_interactive? end |
#non_interactive? ⇒ Boolean
42 43 44 |
# File 'lib/omniauth/strategies/exvo.rb', line 42 def non_interactive? !!request[callback_key] end |
#raw_info ⇒ Object
61 62 63 64 65 |
# File 'lib/omniauth/strategies/exvo.rb', line 61 def raw_info access_token.[:mode] = :query access_token.[:param_name] = :access_token @raw_info ||= access_token.get('/user.json').parsed end |
#request_phase ⇒ Object
14 15 16 17 18 19 |
# File 'lib/omniauth/strategies/exvo.rb', line 14 def request_phase %w(scope x_sign_up).each do |param| [:authorize_params][param.to_sym] = request[param] if request[param] end super end |
#set_failure_handler ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/omniauth/strategies/exvo.rb', line 67 def set_failure_handler OmniAuth.config.on_failure = if interactive? Proc.new do |env| = env['omniauth.error.type'] new_path = "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?message=#{message_key}" [302, { 'Location' => new_path, 'Content-Type'=> 'text/html' }, []] end else OmniAuth.config.on_failure = Proc.new do |env| [401, { 'Content-Type' => 'application/javascript' }, [MultiJson.encode(:error => env['omniauth.error.type'])]] end end end |