Class: OmniAuth::Strategies::Vis

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

Instance Method Summary collapse

Instance Method Details

#callback_urlObject

to fix always getting invalid_grant error see github.com/omniauth/omniauth-oauth2/issues/81#issuecomment-231442739



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

def callback_url
  full_host + script_name + callback_path
end

#on_path?(path) ⇒ Boolean

Fix strange bugs with urls containing double / like dhamma.org//oauth/callback

Returns:

  • (Boolean)


34
35
36
# File 'lib/omniauth/strategies/vis.rb', line 34

def on_path?(path)
  current_path.squeeze('/').casecmp(path.squeeze('/')).zero?
end

#raw_infoObject



44
45
46
# File 'lib/omniauth/strategies/vis.rb', line 44

def raw_info
  @raw_info ||= access_token.get('/api/v1/me.json').parsed
end

#setup_phaseObject



17
18
19
20
21
22
23
# File 'lib/omniauth/strategies/vis.rb', line 17

def setup_phase
  # configure Oauth2 client_options.site from a custom server_url option
  options.client_options.site = options.server_url

  # Authorize all params to be passed to VIS
  options.authorize_params = request.params.to_h
end