lib/sinatra/auth/github.rb in sinatra_auth_github-0.0.5 vs lib/sinatra/auth/github.rb in sinatra_auth_github-0.0.6
- old
+ new
@@ -30,12 +30,13 @@
def github_user
warden.user
end
- def relative_url_for(path)
- request.script_name + path
+ def github_request(path)
+ response = RestClient.get("https://github.com/api/v2/json/#{path}", {:accept => :json, :params => {:token => github_user.token}})
+ JSON.parse(response.body)
end
end
def self.registered(app)
app.use Warden::Manager do |manager|
@@ -50,10 +51,10 @@
app.helpers Helpers
app.get '/auth/github/callback' do
authenticate!
- redirect relative_url_for('/')
+ redirect url_for '/'
end
end
end
end
end