Class: OmniAuth::Strategies::Streamlabs

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

Constant Summary collapse

DEFAULT_SCOPE =
'donations.read'

Instance Method Summary collapse

Instance Method Details

#access_token_optionsObject



48
49
50
# File 'lib/omniauth/strategies/streamlabs.rb', line 48

def access_token_options
  options.access_token_options.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }
end

#authorize_paramsObject



57
58
59
60
61
62
63
64
# File 'lib/omniauth/strategies/streamlabs.rb', line 57

def authorize_params
  super.tap do |params|
    options[:authorize_options].each do |k|
      params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
    end
    params[:scope] = params[:scope] || DEFAULT_SCOPE
  end
end

#build_access_tokenObject



42
43
44
45
46
# File 'lib/omniauth/strategies/streamlabs.rb', line 42

def build_access_token
  super.tap do |token|
    token.options.merge!(access_token_options)
  end
end

#callback_urlObject



52
53
54
55
# File 'lib/omniauth/strategies/streamlabs.rb', line 52

def callback_url
  return options[:redirect_uri] unless options[:redirect_uri].nil?
  full_host + script_name + callback_path
end

#raw_infoObject



38
39
40
# File 'lib/omniauth/strategies/streamlabs.rb', line 38

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