lib/omniauth/strategies/github.rb in oa-oauth-0.0.1 vs lib/omniauth/strategies/github.rb in oa-oauth-0.0.4
- old
+ new
@@ -1,6 +1,7 @@
-require 'json'
+require 'omniauth/oauth'
+require 'multi_json'
module OmniAuth
module Strategies
class GitHub < OAuth2
def initialize(app, app_id, app_secret, options = {})
@@ -9,11 +10,11 @@
options[:access_token_path] = '/login/oauth/access_token'
super(app, :github, app_id, app_secret, options)
end
def user_data
- @data ||= JSON.parse(@access_token.get('/api/v2/json/user/show'))['user']
+ @data ||= MultiJson.decode(@access_token.get('/api/v2/json/user/show'))['user']
end
def user_info
{
'nickname' => user_data["login"],
@@ -33,6 +34,6 @@
'extra' => {'user_hash' => user_data}
})
end
end
end
-end
\ No newline at end of file
+end