Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

support github scopes now too

  • Loading branch information...
commit 5aaeb00880200f86633b009be20eb6e59d4abfc1 1 parent 6e0471f
@atmos atmos authored
Showing with 3 additions and 2 deletions.
  1. +1 −0  lib/sinatra/auth/github.rb
  2. +2 −2 spec/app.rb
View
1  lib/sinatra/auth/github.rb
@@ -49,6 +49,7 @@ def self.registered(app)
manager.failure_app = app.github_options[:failure_app] || BadAuthentication
manager[:github_secret] = app.github_options[:secret]
+ manager[:github_callback_url] = app.github_options[:scopes] || 'email,offline_access'
manager[:github_client_id] = app.github_options[:client_id]
manager[:github_callback_url] = app.github_options[:callback_url] || '/auth/github/callback'
end
View
4 spec/app.rb
@@ -5,7 +5,7 @@ module Example
class App < Sinatra::Base
enable :sessions
- set :github_options, {:client_id => ENV['GH_CLIENT_ID'], :secret => ENV['GH_SECRET'] }
+ set :github_options, {:client_id => ENV['GITHUB_CLIENT_ID'], :secret => ENV['GITHUB_SECRET'], :scopes => 'user,offline_access,repo' }
register Sinatra::Auth::Github
@@ -20,7 +20,7 @@ def repos
end
get '/' do
- "Hello There, #{github_user.name}!\n#{repos.inspect}"
+ "Hello There, #{github_user.name}!#{github_user.token}\n#{repos.inspect}"
end
get '/logout' do
Please sign in to comment.
Something went wrong with that request. Please try again.