Skip to content

sign-in-with-fb#7

Open
nghiadk1102 wants to merge 1 commit intomasterfrom
sign-in-with-fb-gmail
Open

sign-in-with-fb#7
nghiadk1102 wants to merge 1 commit intomasterfrom
sign-in-with-fb-gmail

Conversation

@nghiadk1102
Copy link
Owner

No description provided.

@nghiadk1102 nghiadk1102 force-pushed the sign-in-with-fb-gmail branch from 372fa77 to c68bc59 Compare July 22, 2017 04:33
@nghiadk1102
Copy link
Owner Author

ready

end

def generic_callback provider
@identity = User.from_omniauth(request.env["omniauth.auth"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove ()


@user = @identity || current_user
if @user.persisted?
sign_in_and_redirect @user, :event => :authentication
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event: :authentication

@@ -0,0 +1,22 @@
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
generic_callback "facebook"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generic_callback :facebook

end

def google_oauth2
generic_callback "google_oauth2"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generic_callback :google_oauth2

:recoverable, :rememberable, :trackable, :validatable, :confirmable
devise :database_authenticatable, :registerable, :validatable,
:recoverable, :rememberable, :trackable, :confirmable
devise :omniauthable, :omniauth_providers => [:facebook, :google_oauth2]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omniauth_providers: [:facebook, :google_oauth2]

# Devise will use the `secret_key_base` as its `secret_key`
# by default. You can change it below and use your own secret key.
config.secret_key = "e8c70e82c9b9640a75d868a18103e7cbb462541b07c13d2a9859a5831bb88cbc5f99dc172cecdeb6fc2135da61cd63bd59f73ec1522b4b71eeedf2fd803a519f"
config.omniauth :facebook, "1429323677136476", "efca88e3cddd7da97e3d0deea2d4cbe9", {scope: "email"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bạn tìm hiểu "Rails Environment Variables" rồi áp dụng vào đây nhé

config.secret_key = "e8c70e82c9b9640a75d868a18103e7cbb462541b07c13d2a9859a5831bb88cbc5f99dc172cecdeb6fc2135da61cd63bd59f73ec1522b4b71eeedf2fd803a519f"
config.omniauth :facebook, "1429323677136476", "efca88e3cddd7da97e3d0deea2d4cbe9", {scope: "email"}

config.omniauth :google_oauth2, "101518049891-38cfc85q5fc402blp6kt1lac8ogq8bgv.apps.googleusercontent.com", "X-wbChTGdJwaxfDnoGGpMhVp", skip_jwt: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tương tự

@huongnguyenmta
Copy link
Collaborator

commented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants