Skip to content

Instantly share code, notes, and snippets.

@yum45f
Created September 25, 2017 17:58
Show Gist options
  • Save yum45f/7a3c4efefdfcfa5c17e4918712545eec to your computer and use it in GitHub Desktop.
Save yum45f/7a3c4efefdfcfa5c17e4918712545eec to your computer and use it in GitHub Desktop.
Ruby Sinatra を使ってGoogle認証をする(実験編)
require 'rubygems'
require 'bundler'
require 'sinatra'
require 'omniauth'
require 'omniauth-google-oauth2'
require './app.rb'
use Rack::Session::Cookie, secret: ENV['RACK_COOKIE_SECRET']
use OmniAuth::Builder do
provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], access_type: 'offline', prompt: 'consent', provider_ignores_state: true, scope: 'email,profile'
end
configure do
set :raise_errors, true
set :show_exceptions, false
end
enable :logging
run App.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment