Class: OmniAuth::Strategies::FortnoxOauth2
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::FortnoxOauth2
- Defined in:
- lib/omniauth/strategies/fortnox_oauth2.rb
Overview
Fortnox
Constant Summary collapse
- DEFAULT_SCOPE =
'companyinformation'
Instance Method Summary collapse
Instance Method Details
#build_access_token ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/omniauth/strategies/fortnox_oauth2.rb', line 70 def build_access_token verifier = request.params['code'] client.auth_code.get_token( verifier, { redirect_uri: callback_url }.merge(token_params.to_hash(symbolize_keys: true)), deep_symbolize(.auth_token_params) ) end |
#callback_url ⇒ Object
66 67 68 |
# File 'lib/omniauth/strategies/fortnox_oauth2.rb', line 66 def callback_url [:callback_url] || (full_host + script_name + callback_path) end |
#raw_info ⇒ Object
49 50 51 52 53 54 |
# File 'lib/omniauth/strategies/fortnox_oauth2.rb', line 49 def raw_info return if access_token.blank? api_client = OmniAuth::FortnoxOAuth2::API.new(access_token&.token) @raw_info ||= api_client.get('/companyinformation') end |
#request_phase ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/omniauth/strategies/fortnox_oauth2.rb', line 56 def request_phase [:authorize_params] = { client_id: ['client_id'], response_type: 'code', scope: (['scope'] || DEFAULT_SCOPE) }.merge( ['account_type'] ? { account_type: ['account_type'] } : {} ) super end |