Class: OmniAuth::Strategies::Twitter2

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

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#build_access_tokenObject



54
55
56
57
58
59
60
61
# File 'lib/omniauth/strategies/twitter2.rb', line 54

def build_access_token
  options.token_params.merge!(
    headers: {
      "Authorization" => "Basic #{Base64.strict_encode64("#{options[:client_id]}:#{options[:client_secret]}")}"
    }
  )
  super
end

#callback_urlObject



50
51
52
# File 'lib/omniauth/strategies/twitter2.rb', line 50

def callback_url
  options[:callback_url] || (full_host + script_name + callback_path)
end

#raw_infoObject



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

def raw_info
  @raw_info ||= access_token.get(
    "/2/users/me?" \
    "&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id," \
    "profile_image_url,protected,public_metrics,url,username,verified,withheld",
    { headers: { "Authorization" => "Bearer #{access_token.token}" } }
  ).parsed || {}
end