forked from External/greenlight
add twitter and google oauth login
This commit is contained in:
parent
0d73a77f1f
commit
3eeaacc6f4
|
@ -16,6 +16,7 @@
|
||||||
/tmp/*
|
/tmp/*
|
||||||
!/log/.keep
|
!/log/.keep
|
||||||
!/tmp/.keep
|
!/tmp/.keep
|
||||||
|
.env
|
||||||
|
|
||||||
# Ignore Byebug command history file.
|
# Ignore Byebug command history file.
|
||||||
.byebug_history
|
.byebug_history
|
||||||
|
|
3
Gemfile
3
Gemfile
|
@ -33,6 +33,7 @@ gem 'jbuilder', '~> 2.5'
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||||
gem 'byebug', platform: :mri
|
gem 'byebug', platform: :mri
|
||||||
|
gem 'dotenv-rails'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
|
@ -48,4 +49,6 @@ end
|
||||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||||
|
|
||||||
gem 'omniauth'
|
gem 'omniauth'
|
||||||
|
gem 'omniauth-twitter'
|
||||||
|
gem 'omniauth-google-oauth2'
|
||||||
gem 'bigbluebutton-api-ruby'
|
gem 'bigbluebutton-api-ruby'
|
||||||
|
|
34
Gemfile.lock
34
Gemfile.lock
|
@ -52,8 +52,14 @@ GEM
|
||||||
coffee-script-source (1.10.0)
|
coffee-script-source (1.10.0)
|
||||||
concurrent-ruby (1.0.2)
|
concurrent-ruby (1.0.2)
|
||||||
debug_inspector (0.0.2)
|
debug_inspector (0.0.2)
|
||||||
|
dotenv (2.1.1)
|
||||||
|
dotenv-rails (2.1.1)
|
||||||
|
dotenv (= 2.1.1)
|
||||||
|
railties (>= 4.0, < 5.1)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
|
faraday (0.9.2)
|
||||||
|
multipart-post (>= 1.2, < 3)
|
||||||
ffi (1.9.14)
|
ffi (1.9.14)
|
||||||
globalid (0.3.7)
|
globalid (0.3.7)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.1.0)
|
||||||
|
@ -66,6 +72,8 @@ GEM
|
||||||
rails-dom-testing (>= 1, < 3)
|
rails-dom-testing (>= 1, < 3)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
|
json (1.8.3)
|
||||||
|
jwt (1.5.6)
|
||||||
listen (3.0.8)
|
listen (3.0.8)
|
||||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||||
rb-inotify (~> 0.9, >= 0.9.7)
|
rb-inotify (~> 0.9, >= 0.9.7)
|
||||||
|
@ -80,12 +88,35 @@ GEM
|
||||||
mini_portile2 (2.1.0)
|
mini_portile2 (2.1.0)
|
||||||
minitest (5.9.1)
|
minitest (5.9.1)
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.1)
|
||||||
|
multi_xml (0.5.5)
|
||||||
|
multipart-post (2.0.0)
|
||||||
nio4r (1.2.1)
|
nio4r (1.2.1)
|
||||||
nokogiri (1.6.8.1)
|
nokogiri (1.6.8.1)
|
||||||
mini_portile2 (~> 2.1.0)
|
mini_portile2 (~> 2.1.0)
|
||||||
|
oauth (0.5.1)
|
||||||
|
oauth2 (1.2.0)
|
||||||
|
faraday (>= 0.8, < 0.10)
|
||||||
|
jwt (~> 1.0)
|
||||||
|
multi_json (~> 1.3)
|
||||||
|
multi_xml (~> 0.5)
|
||||||
|
rack (>= 1.2, < 3)
|
||||||
omniauth (1.3.1)
|
omniauth (1.3.1)
|
||||||
hashie (>= 1.2, < 4)
|
hashie (>= 1.2, < 4)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
|
omniauth-google-oauth2 (0.4.1)
|
||||||
|
jwt (~> 1.5.2)
|
||||||
|
multi_json (~> 1.3)
|
||||||
|
omniauth (>= 1.1.1)
|
||||||
|
omniauth-oauth2 (>= 1.3.1)
|
||||||
|
omniauth-oauth (1.1.0)
|
||||||
|
oauth
|
||||||
|
omniauth (~> 1.0)
|
||||||
|
omniauth-oauth2 (1.4.0)
|
||||||
|
oauth2 (~> 1.0)
|
||||||
|
omniauth (~> 1.2)
|
||||||
|
omniauth-twitter (1.2.1)
|
||||||
|
json (~> 1.3)
|
||||||
|
omniauth-oauth (~> 1.1)
|
||||||
puma (3.6.0)
|
puma (3.6.0)
|
||||||
rack (2.0.1)
|
rack (2.0.1)
|
||||||
rack-test (0.6.3)
|
rack-test (0.6.3)
|
||||||
|
@ -164,10 +195,13 @@ DEPENDENCIES
|
||||||
bigbluebutton-api-ruby
|
bigbluebutton-api-ruby
|
||||||
byebug
|
byebug
|
||||||
coffee-rails (~> 4.2)
|
coffee-rails (~> 4.2)
|
||||||
|
dotenv-rails
|
||||||
jbuilder (~> 2.5)
|
jbuilder (~> 2.5)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
listen (~> 3.0.5)
|
listen (~> 3.0.5)
|
||||||
omniauth
|
omniauth
|
||||||
|
omniauth-google-oauth2
|
||||||
|
omniauth-twitter
|
||||||
puma (~> 3.0)
|
puma (~> 3.0)
|
||||||
rails (~> 5.0.0, >= 5.0.0.1)
|
rails (~> 5.0.0, >= 5.0.0.1)
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
|
|
|
@ -33,3 +33,13 @@
|
||||||
<div id="landing_page_footer_oauth_append">
|
<div id="landing_page_footer_oauth_append">
|
||||||
<p>You can have a personal URL (with recordings) by signing in below</p>
|
<p>You can have a personal URL (with recordings) by signing in below</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% if current_user.nil? %>
|
||||||
|
<ul>
|
||||||
|
<li><%= link_to 'Twitter', '/auth/twitter' %></li>
|
||||||
|
<li><%= link_to 'Google', '/auth/google' %></li>
|
||||||
|
</ul>
|
||||||
|
<% else %>
|
||||||
|
<div>Hello <%= current_user.name %></div>
|
||||||
|
<%= link_to 'Logout', '/logout' %>
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
||||||
|
provider :twitter, ENV['TWITTER_ID'], ENV['TWITTER_SECRET']
|
||||||
|
provider :google_oauth2, ENV['GOOGLE_OAUTH2_ID'], ENV['GOOGLE_OAUTH2_SECRET'],
|
||||||
|
scope: 'profile', access_type: 'online', name: 'google'
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
TWITTER_ID=
|
||||||
|
TWITTER_SECRET=
|
||||||
|
GOOGLE_OAUTH2_ID=
|
||||||
|
GOOGLE_OAUTH2_SECRET=
|
Loading…
Reference in New Issue