add github for openid login
This commit is contained in:
parent
c8e741d0ca
commit
bf6b09d9f4
5 changed files with 12 additions and 2 deletions
1
Gemfile
1
Gemfile
|
|
@ -19,6 +19,7 @@ gem 'omniauth'
|
||||||
gem 'omniauth-facebook'
|
gem 'omniauth-facebook'
|
||||||
gem 'omniauth-openid'
|
gem 'omniauth-openid'
|
||||||
gem 'omniauth-google-oauth2'
|
gem 'omniauth-google-oauth2'
|
||||||
|
gem 'omniauth-github'
|
||||||
|
|
||||||
# Use cancancan as authorization framework
|
# Use cancancan as authorization framework
|
||||||
gem 'cancancan'
|
gem 'cancancan'
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,9 @@ GEM
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
omniauth-facebook (1.6.0)
|
omniauth-facebook (1.6.0)
|
||||||
omniauth-oauth2 (~> 1.1)
|
omniauth-oauth2 (~> 1.1)
|
||||||
|
omniauth-github (1.1.2)
|
||||||
|
omniauth (~> 1.0)
|
||||||
|
omniauth-oauth2 (~> 1.1)
|
||||||
omniauth-google-oauth2 (0.2.4)
|
omniauth-google-oauth2 (0.2.4)
|
||||||
omniauth (~> 1.0)
|
omniauth (~> 1.0)
|
||||||
omniauth-oauth2 (~> 1.1)
|
omniauth-oauth2 (~> 1.1)
|
||||||
|
|
@ -429,6 +432,7 @@ DEPENDENCIES
|
||||||
mysql2
|
mysql2
|
||||||
omniauth
|
omniauth
|
||||||
omniauth-facebook
|
omniauth-facebook
|
||||||
|
omniauth-github
|
||||||
omniauth-google-oauth2
|
omniauth-google-oauth2
|
||||||
omniauth-openid
|
omniauth-openid
|
||||||
paper_trail
|
paper_trail
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ class User < ActiveRecord::Base
|
||||||
# :lockable, :timeoutable and :omniauthable
|
# :lockable, :timeoutable and :omniauthable
|
||||||
devise :database_authenticatable, :registerable,
|
devise :database_authenticatable, :registerable,
|
||||||
:recoverable, :rememberable, :trackable, :validatable, :confirmable,
|
:recoverable, :rememberable, :trackable, :validatable, :confirmable,
|
||||||
:omniauthable, omniauth_providers: [:suse, :google, :facebook]
|
:omniauthable, omniauth_providers: [:suse, :google, :facebook, :github]
|
||||||
|
|
||||||
has_and_belongs_to_many :roles
|
has_and_belongs_to_many :roles
|
||||||
has_many :openids
|
has_many :openids
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ Devise.setup do |config|
|
||||||
name: 'google',
|
name: 'google',
|
||||||
scope: 'email'
|
scope: 'email'
|
||||||
config.omniauth :facebook, Rails.application.secrets.facebook_key, Rails.application.secrets.facebook_secret
|
config.omniauth :facebook, Rails.application.secrets.facebook_key, Rails.application.secrets.facebook_secret
|
||||||
|
config.omniauth :github, Rails.application.secrets.github_key, Rails.application.secrets.github_secret
|
||||||
|
|
||||||
# ==> Mailer Configuration
|
# ==> Mailer Configuration
|
||||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,12 @@ production:
|
||||||
# For example:
|
# For example:
|
||||||
#suse_key: 'sample data'
|
#suse_key: 'sample data'
|
||||||
#suse_secret: 'sample data'
|
#suse_secret: 'sample data'
|
||||||
|
|
||||||
suse_key: ''
|
suse_key: ''
|
||||||
suse_secret: ''
|
suse_secret: ''
|
||||||
|
|
||||||
|
|
||||||
|
# Register your application with GitHub from https://github.com/settings/applications
|
||||||
|
github_key: '7e38bdc9408721600e2c'
|
||||||
|
github_secret: '0290d60c27b1f0b9e88d73551862f6e0136976ba'
|
||||||
|
|
||||||
# If you add more providers that do not require a key, you still have to create the 2 variables with sample data
|
# If you add more providers that do not require a key, you still have to create the 2 variables with sample data
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue