Class: OmniAuth::Strategies::Line

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/line.rb

Instance Method Summary collapse

Instance Method Details

#callback_phaseObject

host changed



17
18
19
20
# File 'lib/omniauth/strategies/line.rb', line 17

def callback_phase
  options[:client_options][:site] = 'https://api.line.me'
  super
end

#callback_urlObject



22
23
24
25
# File 'lib/omniauth/strategies/line.rb', line 22

def callback_url
  # Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7
  options[:callback_url] || (full_host + script_name + callback_path)
end

#fetch_emailObject



46
47
48
49
50
51
# File 'lib/omniauth/strategies/line.rb', line 46

def fetch_email
  data = JSON.load(access_token.post('oauth2/v2.1/verify', params: { id_token: access_token.params['id_token'], client_id: options['client_id'] }).body)
  data['email']
rescue ::Errno::ETIMEDOUT
  raise ::Timeout::Error
end

#raw_infoObject

Require: Access token with PROFILE permission issued.



40
41
42
43
44
# File 'lib/omniauth/strategies/line.rb', line 40

def raw_info
  @raw_info ||= JSON.load(access_token.get('v2/profile').body)
rescue ::Errno::ETIMEDOUT
  raise ::Timeout::Error
end