lib/sorcery/controller/submodules/external/providers/google.rb in sorcery-0.8.1 vs lib/sorcery/controller/submodules/external/providers/google.rb in sorcery-0.8.2
- old
+ new
@@ -25,10 +25,11 @@
update!
end
end
module GoogleClient
+ include Base::BaseClient
class << self
attr_accessor :key,
:secret,
:callback_url,
:site,
@@ -48,13 +49,13 @@
@user_info_url = "https://www.googleapis.com/oauth2/v1/userinfo"
@scope = "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
@user_info_mapping = {}
end
- def get_user_hash
+ def get_user_hash(access_token)
user_hash = {}
- response = @access_token.get(@user_info_url)
+ response = access_token.get(@user_info_url)
user_hash[:user_info] = JSON.parse(response.body)
user_hash[:uid] = user_hash[:user_info]['id']
user_hash
end
@@ -74,10 +75,10 @@
args.merge!({:code => params[:code]}) if params[:code]
options = {
:token_url => @token_url,
:token_method => :post
}
- @access_token = self.get_access_token(args, options)
+ return self.get_access_token(args, options)
end
end
init
end