[logaling-commit] logaling/logaling-server [master] Add facebook to OAuth provider

アーカイブの一覧に戻る

SHIMADA Koji null+****@clear*****
Thu Aug 23 13:48:52 JST 2012


SHIMADA Koji	2012-08-23 13:48:52 +0900 (Thu, 23 Aug 2012)

  New Revision: a8b0c9fc9fa6e0a3bea8c102adcbf45c75670b6f
  https://github.com/logaling/logaling-server/commit/a8b0c9fc9fa6e0a3bea8c102adcbf45c75670b6f

  Merged 111235b: Merge branch 'add-user-authentication' into merge-add-user-authentication

  Log:
    Add facebook to OAuth provider
    
    - register your application to facebook:
     - http://developers.facebook.com/
    - write Client ID and Client Secret to .env

  Modified files:
    .env.sample
    app/views/layouts/application.html.haml
    config/initializers/omniauth.rb

  Modified: .env.sample (+3 -0)
===================================================================
--- .env.sample    2012-08-23 13:32:00 +0900 (c75ba48)
+++ .env.sample    2012-08-23 13:48:52 +0900 (233bb3f)
@@ -1,2 +1,5 @@
 GITHUB_KEY=your-github-key
 GITHUB_SECRET=your-github-secret
+
+FACEBOOK_KEY=your-facebook-key
+FACEBOOK_SECRET=your-facebook-secret

  Modified: app/views/layouts/application.html.haml (+2 -1)
===================================================================
--- app/views/layouts/application.html.haml    2012-08-23 13:32:00 +0900 (ffc239c)
+++ app/views/layouts/application.html.haml    2012-08-23 13:48:52 +0900 (cec2e61)
@@ -35,7 +35,8 @@
             - else
               - if Rails.env.development?
                 %li= link_to "Sign in (for dev)", "/auth/developer"
-                %li= link_to "Sign in with Github", "/auth/github"
+              - %w(github facebook).each do |provider|
+                %li= link_to "Sign in with #{provider.capitalize}", "/auth/#{provider}"
 
     .container
 

  Modified: config/initializers/omniauth.rb (+2 -1)
===================================================================
--- config/initializers/omniauth.rb    2012-08-23 13:32:00 +0900 (ccdce73)
+++ config/initializers/omniauth.rb    2012-08-23 13:48:52 +0900 (992e685)
@@ -1,4 +1,5 @@
 Rails.application.config.middleware.use OmniAuth::Builder do
   provider :developer unless Rails.env.production?
-  provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
+  provider :github,   ENV['GITHUB_KEY'],   ENV['GITHUB_SECRET']
+  provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
 end
-------------- next part --------------
An HTML attachment was scrubbed...
ダウンロード 



More information about the logaling-commit mailing list
アーカイブの一覧に戻る