Class: OmniAuth::Strategies::AmazonSpApi

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/amazon-sp-api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#mws_auth_tokenObject (readonly)

Returns the value of attribute mws_auth_token.



6
7
8
# File 'lib/omniauth/strategies/amazon-sp-api.rb', line 6

def mws_auth_token
  @mws_auth_token
end

#selling_partner_idObject (readonly)

Returns the value of attribute selling_partner_id.



6
7
8
# File 'lib/omniauth/strategies/amazon-sp-api.rb', line 6

def selling_partner_id
  @selling_partner_id
end

Instance Method Details

#build_access_tokenObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/omniauth/strategies/amazon-sp-api.rb', line 30

def build_access_token
  verifier = request.params['spapi_oauth_code']
  client.auth_code.get_token(
    verifier,
    { redirect_uri: callback_url }.merge(
      token_params.to_hash(symbolize_keys: true)
    ),
    deep_symbolize(options.auth_token_params)
  )
end

#callback_phaseObject



24
25
26
27
28
# File 'lib/omniauth/strategies/amazon-sp-api.rb', line 24

def callback_phase
  @selling_partner_id = request.params['selling_partner_id']
  @mws_auth_token = request.params['mws_auth_token']
  super
end

#callback_urlObject



41
42
43
# File 'lib/omniauth/strategies/amazon-sp-api.rb', line 41

def callback_url
  options[:redirect_uri] || full_host + script_name + callback_path
end