class OmniAuth::Strategies::Lexoffice

Public Instance Methods

authorize_params() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/lexoffice.rb, line 36
def authorize_params
  # params = super
  params = {client_id: options.client_id, response_type:'code'}
  params.merge!(super)
end
basic_auth_header(client_id, client_secret) click to toggle source
# File lib/omniauth/strategies/lexoffice.rb, line 75
def basic_auth_header(client_id, client_secret)
  'Basic ' + Base64.encode64(client_id + ':' + client_secret).delete("\n")
end
callback_url() click to toggle source
# File lib/omniauth/strategies/lexoffice.rb, line 51
def callback_url
  return full_host + script_name + callback_path + "?shop=#{request.params["shop"]}" if request.params["shop"].present?
  full_host + script_name + callback_path
end
redirect(uri) click to toggle source
# File lib/omniauth/strategies/lexoffice.rb, line 56
def redirect(uri)
  r = Rack::Response.new
  if options[:iframe]
    r.write("<script type='text/javascript' charset='utf-8'>
      window.setTimeout(function() {
              window.top.location.href = '#{uri}'; // this window will not open
          }, 100);
    </script>")
  else
    r.write("Redirecting to #{uri}...")
    r.redirect(uri)
  end

  r.finish
end
request_phase() click to toggle source
# File lib/omniauth/strategies/lexoffice.rb, line 46
def request_phase
  #authorize call
  redirect client.auth_code.authorize_url({:redirect_uri => callback_url}.merge(authorize_params))
end
setup_phase() click to toggle source

These are called after authentication has succeeded. If possible, you should try to set the UID without making additional calls (if the user id is returned with the token or as a URI parameter). This may not be possible with all providers.

Calls superclass method
# File lib/omniauth/strategies/lexoffice.rb, line 31
def setup_phase
  super

end
token_params() click to toggle source
# File lib/omniauth/strategies/lexoffice.rb, line 42
def token_params
  options.token_params.merge!(:headers => {'Authorization' => basic_auth_header(options.client_id,options.client_secret), 'Accept' => 'application/json' })
end