lib/sorcery/controller/submodules/external/providers/github.rb in sorcery-0.7.4 vs lib/sorcery/controller/submodules/external/providers/github.rb in sorcery-0.7.5

- old
+ new

@@ -29,19 +29,23 @@ module GithubClient class << self attr_accessor :key, :secret, :callback_url, + :auth_path, + :token_path, :site, :user_info_path, :user_info_mapping include Protocols::Oauth2 def init @site = "https://github.com/" - @user_info_path = "/api/v2/json/user/show" + @user_info_path = "https://api.github.com/user" + @auth_path = "/login/oauth/authorize" + @token_path = "/login/oauth/access_token" @user_info_mapping = {} end def get_user_hash user_hash = {} @@ -56,17 +60,21 @@ end # calculates and returns the url to which the user should be redirected, # to get authenticated at the external provider's site. def login_url(params,session) - self.authorize_url({:authorize_path => '/login/oauth/authorize'}) + self.authorize_url({:authorize_path => @auth_path}) end # tries to login the user from access token def process_callback(params,session) args = {} args.merge!({:code => params[:code]}) if params[:code] - @access_token = self.get_access_token(args) + options = { + :access_token_path => @token_path, + :access_token_method => :post + } + @access_token = self.get_access_token(args, options) end end init end