lib/warden-github/strategy.rb in warden-github-0.12.0 vs lib/warden-github/strategy.rb in warden-github-0.12.1
- old
+ new
@@ -52,11 +52,11 @@
env['warden'].config[:github_oauth_domain],
callback_url)
end
def user_info_for(token)
- @user_info ||= RestClient.get("https://api.github.com/user", :params => {:access_token => token})
+ @user_info ||= RestClient.get(github_api_uri + "/user", :params => {:access_token => token})
end
def callback_url
absolute_url(request, env['warden'].config[:github_callback_url], env['HTTP_X_FORWARDED_PROTO'])
end
@@ -69,7 +69,15 @@
request.port == 443 ? "" : ":#{request.port}"
end
proto = "http" if proto.nil?
"#{proto}://#{request.host}#{port_part}#{suffix}"
+ end
+
+ def github_api_uri
+ if ENV['OCTOKIT_API_ENDPOINT']
+ ENV['OCTOKIT_API_ENDPOINT']
+ else
+ "https://api.github.com"
+ end
end
end