32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/omniauth/strategies/lastfm.rb', line 32
def callback_phase
@json = {}
token = request.params["token"]
begin
params = { :api_key => options.api_key,
:token => token,
:api_sig => signature(token),
:method => "auth.getSession",
:format => 'json'}
response = RestClient.get(options.client_options.api_url, { :params => params })
session = MultiJson.decode(response.to_s)
@json.merge!(session)
params = {:api_key => options.api_key,
:user => @json['session']['name'],
:method => 'user.getInfo',
:format => 'json'}
response = RestClient.get(options.client_options.api_url, { :params => params })
user = MultiJson.decode(response.to_s)
@json.merge!(user)
rescue ::RestClient::Exception
raise ::Timeout::Error
end
super
end
|