Class: OmniAuth::Strategies::Traity
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Traity
show all
- Defined in:
- lib/omniauth/strategies/traity.rb
Defined Under Namespace
Classes: NoAuthorizationCodeError
Constant Summary
collapse
- DEFAULT_SCOPE =
'email'
Instance Method Summary
collapse
Instance Method Details
#appsecret_proof ⇒ Object
83
84
85
|
# File 'lib/omniauth/strategies/traity.rb', line 83
def appsecret_proof
@appsecret_proof ||= OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA256.new, client.secret, access_token.token)
end
|
#authorize_params ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/omniauth/strategies/traity.rb', line 54
def authorize_params
super.tap do |params|
%w[display scope].each do |v|
if request.params[v]
params[v.to_sym] = request.params[v]
end
end
params[:scope] ||= DEFAULT_SCOPE
end
end
|
#callback_phase ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/omniauth/strategies/traity.rb', line 46
def callback_phase
with_authorization_code! do
super
end
rescue NoAuthorizationCodeError => e
fail!(:no_authorization_code, e)
end
|
#callback_url ⇒ Object
42
43
44
|
# File 'lib/omniauth/strategies/traity.rb', line 42
def callback_url
options[:callback_url] || super
end
|
#info_options ⇒ Object
70
71
72
73
74
|
# File 'lib/omniauth/strategies/traity.rb', line 70
def info_options
params = {:appsecret_proof => appsecret_proof}
params.merge!({:locale => options[:locale]}) if options[:locale]
{ :params => params }
end
|
#prune!(hash) ⇒ Object
76
77
78
79
80
81
|
# File 'lib/omniauth/strategies/traity.rb', line 76
def prune!(hash)
hash.delete_if do |_, value|
prune!(value) if value.is_a?(Hash)
value.nil? || (value.respond_to?(:empty?) && value.empty?)
end
end
|
#raw_info ⇒ Object
66
67
68
|
# File 'lib/omniauth/strategies/traity.rb', line 66
def raw_info
@raw_info ||= access_token.get('1.0/me', info_options).parsed || {}
end
|