Sha256: 9ebd39a9b95999e19770c7bb61da671bf143f463406edce72abc5123e91e7ad8

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

require 'pp'

module Example
  class App < Sinatra::Base
    enable :sessions

    set  :github_options, { :client_id => ENV['GH_CLIENT_ID'],
                            :secret    => ENV['GH_SECRET'],
                            :scopes    => 'user,offline_access,repo' }

    register Sinatra::Auth::Github

    before do
      authenticate!
    end

    helpers do
      def repos
        github_request("repos/show/#{github_user.login}")
      end
    end

    get '/' do
      "Hello There, #{github_user.name}!#{github_user.token}\n#{repos.inspect}"
    end

    get '/logout' do
      logout!
      redirect '/'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinatra_auth_github-0.0.13 spec/app.rb