Class: OmniAuth::Strategies::Threads

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

Constant Summary collapse

DEFAULT_SCOPE =
"threads_basic"
DEFAULT_FIELDS =
"id,username,name,threads_profile_picture_url,threads_biography"

Instance Method Summary collapse

Instance Method Details

#callback_urlObject



47
48
49
# File 'lib/omniauth/strategies/threads.rb', line 47

def callback_url
  full_host + callback_path
end

#long_lived_tokenObject



55
56
57
# File 'lib/omniauth/strategies/threads.rb', line 55

def long_lived_token
  @long_lived_token ||= ::OAuth2::AccessToken.from_hash(client, access_token.get("/access_token", params: {grant_type: "th_exchange_token", client_secret: options.client_secret, access_token: access_token.token}).parsed)
end

#raw_infoObject



51
52
53
# File 'lib/omniauth/strategies/threads.rb', line 51

def raw_info
  @raw_info ||= long_lived_token.get("/me", params: {fields: DEFAULT_FIELDS}).parsed
end

#token_paramsObject



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

def token_params
  super.tap do |params|
    params[:client_id] = options.client_id
    params[:client_secret] = options.client_secret
  end
end