SHIMADA Koji
null+****@clear*****
Thu Aug 23 13:25:15 JST 2012
SHIMADA Koji 2012-08-23 13:25:15 +0900 (Thu, 23 Aug 2012) New Revision: c0c9297f688dbbe767f2a186b6630afedeb271f0 https://github.com/logaling/logaling-server/commit/c0c9297f688dbbe767f2a186b6630afedeb271f0 Log: Add github to OAuth provider - add .env to your project - register your application to github: -- https://github.com/settings/applications/new - write Client ID and Client Secret for OAuth to .env - run app -- % foreman run rails s Added files: .env.sample Modified files: .gitignore app/views/layouts/application.html.haml config/initializers/omniauth.rb Added: .env.sample (+2 -0) 100644 =================================================================== --- /dev/null +++ .env.sample 2012-08-23 13:25:15 +0900 (c75ba48) @@ -0,0 +1,2 @@ +GITHUB_KEY=your-github-key +GITHUB_SECRET=your-github-secret Modified: .gitignore (+2 -0) =================================================================== --- .gitignore 2012-08-23 13:17:33 +0900 (9aa845f) +++ .gitignore 2012-08-23 13:25:15 +0900 (856e6a7) @@ -16,3 +16,5 @@ # Ignore project specific directories. /data.* + +.env Modified: app/views/layouts/application.html.haml (+2 -1) =================================================================== --- app/views/layouts/application.html.haml 2012-08-23 13:17:33 +0900 (234e5f1) +++ app/views/layouts/application.html.haml 2012-08-23 13:25:15 +0900 (ffc239c) @@ -34,7 +34,8 @@ %li= link_to "Sign out", signout_path - else - if Rails.env.development? - %li= link_to "Sign in", "/auth/developer" + %li= link_to "Sign in (for dev)", "/auth/developer" + %li= link_to "Sign in with Github", "/auth/github" .container Modified: config/initializers/omniauth.rb (+1 -0) =================================================================== --- config/initializers/omniauth.rb 2012-08-23 13:17:33 +0900 (2982fd0) +++ config/initializers/omniauth.rb 2012-08-23 13:25:15 +0900 (ccdce73) @@ -1,3 +1,4 @@ Rails.application.config.middleware.use OmniAuth::Builder do provider :developer unless Rails.env.production? + provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'] end -------------- next part -------------- An HTML attachment was scrubbed... 下载