Sha256: 27e17352f0fea146a73fb007543162dc8d120089ea597dc6140575a84fdf7431

Contents?: true

Size: 514 Bytes

Versions: 5

Compression:

Stored size: 514 Bytes

Contents

require 'rubygems'
require 'bundler'

Bundler.setup :default, :development, :example
require 'sinatra'
require 'omniauth'
require 'omniauth-google-oauth2'

use Rack::Session::Cookie

use OmniAuth::Builder do
  provider :google_oauth2,  ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET']
end

get '/' do
  <<-HTML
  <ul>
    <li><a href='/auth/google_oauth2'>Sign in with Google</a></li>
  </ul>
  HTML
end

get '/auth/:provider/callback' do
  content_type 'text/plain'
  request.env['omniauth.auth'].info.to_hash.inspect
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
omniauth-google-oauth2-0.0.5 examples/sinatra.rb
omniauth-google-oauth2-0.0.4 examples/sinatra.rb
omniauth-google-oauth2-0.0.3 examples/sinatra.rb
omniauth-google-oauth2-0.0.2 examples/sinatra.rb
omniauth-google-oauth2-0.0.1 examples/sinatra.rb