Last active
June 14, 2016 06:06
-
-
Save mostlyfine/22b25ee77a0d7b0384493efb20272629 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], { | |
:scope => 'https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/plus.stream.read https://www.googleapis.com/auth/plus.stream.write https://www.googleapis.com/auth/plus.circles.read https://www.googleapis.com/auth/plus.circles.write' | |
} | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment