Class: OmniAuth::Strategies::Twitch
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Twitch
- Defined in:
- lib/omniauth/strategies/twitch.rb
Constant Summary collapse
- DEFAULT_SCOPE =
"user:read:email".freeze
Instance Method Summary collapse
- #access_token_options ⇒ Object
- #authorize_params ⇒ Object
- #build_access_token ⇒ Object
- #callback_url ⇒ Object
- #raw_info ⇒ Object
Instance Method Details
#access_token_options ⇒ Object
64 65 66 |
# File 'lib/omniauth/strategies/twitch.rb', line 64 def ..inject({}) { |h,(k,v)| h[k.to_sym] = v; h } end |
#authorize_params ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/omniauth/strategies/twitch.rb', line 73 def super.tap do |params| [: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_token ⇒ Object
58 59 60 61 62 |
# File 'lib/omniauth/strategies/twitch.rb', line 58 def build_access_token super.tap do |token| token..merge!() end end |
#callback_url ⇒ Object
68 69 70 71 |
# File 'lib/omniauth/strategies/twitch.rb', line 68 def callback_url return [:redirect_uri] unless [:redirect_uri].nil? full_host + script_name + callback_path end |
#raw_info ⇒ Object
52 53 54 55 56 |
# File 'lib/omniauth/strategies/twitch.rb', line 52 def raw_info @raw_info ||= access_token.get("https://api.twitch.tv/helix/users").parsed. fetch("data").fetch(0) end |