Class: OmniAuth::Strategies::Forcedotcom

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/Salesforce/oauth2/forcedotcom.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, client_id = nil, client_secret = nil, options = {}, &block) ⇒ Forcedotcom

Initialize the middleware

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :sign_in (Boolean, true)

    When true, use a sign-in flow instead of the authorization flow.

  • :mobile (Boolean, false)

    When true, use the mobile sign-in interface.



14
15
16
17
18
19
20
21
# File 'lib/Salesforce/oauth2/forcedotcom.rb', line 14

def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
  client_options = {
    :site => "https://login.salesforce.com",
    :authorize_path      => "/services/oauth2/authorize",
    :access_token_path   => "/services/oauth2/token"
  }
  super(app, :forcedotcom, client_id, client_secret, client_options, &block) 
end

Instance Method Details

#auth_hashObject



33
34
35
36
37
# File 'lib/Salesforce/oauth2/forcedotcom.rb', line 33

def auth_hash
   OmniAuth::Utils.deep_merge(super, {
     'instance_url' => @access_token['instance_url']
   })
end

#callback_phaseObject



28
29
30
31
# File 'lib/Salesforce/oauth2/forcedotcom.rb', line 28

def callback_phase
  options[:grant_type] ||= 'authorization_code'
  super
end

#request_phaseObject



23
24
25
26
# File 'lib/Salesforce/oauth2/forcedotcom.rb', line 23

def request_phase
  options[:response_type] ||= 'code'
  super
end