8000 twitter auth · Annastacia-dev/omniauth-rails@18a8834 · GitHub
[go: up one dir, main page]

Skip to content

Commit 18a8834

Browse files
author
Annastacia Mumbua Kioko
committed
twitter auth
1 parent 4c17e16 commit 18a8834

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,5 @@ gem 'omniauth-rails_csrf_protection'
9292
gem 'omniauth-facebook'
9393

9494
gem 'omniauth-github'
95+
96+
gem 'omniauth-twitter2'

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ GEM
170170
omniauth-rails_csrf_protection (1.0.1)
171171
actionpack (>= 4.2)
172172
omniauth (~> 2.0)
173+
omniauth-twitter2 (0.1.0)
174+
omniauth
175+
omniauth-oauth2 (~> 1.0)
173176
pg (1.4.5)
174177
public_suffix (5.0.1)
175178
puma (5.6.5)
@@ -275,6 +278,7 @@ DEPENDENCIES
275278
omniauth-github
276279
omniauth-google-oauth2
277280
omniauth-rails_csrf_protection
281+
omniauth-twitter2
278282
pg
279283
puma (~> 5.0)
280284
rails (~> 7.0.4)

app/assets/stylesheets/application.css.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,10 @@ h2{
179179
border: 1px solid #3b5998;
180180
}
181181

182+
.twitter{
183+
background: #1da1f2;
184+
color: #fff;
185+
border: 1px solid #1da1f2;
186+
}
187+
182188

app/views/sessions/new.html.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
<%= button_to '/auth/github', method: :post, class: 'github' do %>
2525
<%= icon('fab', 'github') %>
2626
<% end %>
27+
<%= button_to '/auth/twitter2', method: :post, class: 'twitter' do %>
28+
<%= icon('fab', 'twitter') %>
29+
<% end %>
2730
</div>
2831

2932
</div>

config/initializers/omniauth.rb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
Rails.application.config.middleware.use OmniAuth::Builder do
2-
provider :google_oauth2, ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET'],
3-
{
4-
prompt: 'select_account'
5-
}
6-
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'],
7-
{
8-
prompt: 'select_account'
9-
}
2+
provider :google_oauth2, ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET']
3+
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET']
104
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
5+
provider :twitter2, ENV["TWITTER_CLIENT_ID"], ENV["TWITTER_CLIENT_SECRET"], callback_path: '/auth/twitter2/callback', scope: "tweet.read users.read"
116
end

0 commit comments

Comments
 (0)
0