lib/warden-github/strategy.rb in warden-github-0.4.1 vs lib/warden-github/strategy.rb in warden-github-0.4.2
- old
+ new
@@ -8,15 +8,15 @@
def authenticate!
if params['code']
begin
api = api_for(params['code'])
- resp = api.get '/api/v3/user' do |request|
+ resp = api.get '/api/v2/json/user/show' do |request|
request.params['access_token'] = api.token
end.body
user = JSON.load(resp)
- success!(Warden::Github::Oauth::User.new(user, api.token))
+ success!(Warden::Github::Oauth::User.new(user['user'], api.token))
rescue OAuth2::Error
%(<p>Outdated ?code=#{params['code']}:</p><p>#{$!}</p><p><a href="/auth/github">Retry</a></p>)
end
else
env['rack.session']['return_to'] = env['REQUEST_URI']