lib/omniauth/strategies/gitlab.rb in omniauth-gitlab-0.0.3 vs lib/omniauth/strategies/gitlab.rb in omniauth-gitlab-0.0.4
- old
+ new
@@ -3,10 +3,11 @@
class GitLab
include OmniAuth::Strategy
option :fields, [:email]
option :site, nil
+ option :v, 'v3'
option :uid_field, :email
option :on_login, nil
option :on_registration, nil
option :on_failed_registration, nil
@@ -47,10 +48,10 @@
def identity
@identity ||= begin
conn = Faraday.new(:url => options[:site])
resp = conn.post do |req|
- req.url '/api/v3/session'
+ req.url "/api/#{options[:v]}/session"
req.headers['Content-Type'] = 'application/json'
req.params = { :email => request['email'], :password => request['password'] }
end
resp.success? ? MultiJson.decode(resp.body) : nil
end
\ No newline at end of file