简体   繁体   English

如何使用Devise Omniauth +(Facebook,Twitter,Google)完成多重身份验证?

[英]How to accomplish multiple authentication using Devise Omniauth + (Facebook , Twitter, Google )?

I have implemented the Devise Omniauth authentication in my Rails application successfully using the following tutorial by git OmniAuth: Overview 我已经使用git OmniAuth的以下教程成功地在我的Rails应用程序中实现了Devise Omniauth身份验证:概述

But it will not support multiple authentications , may be you all know that , and have faced the same issue before, but if you people have tweaked the same problem successfully please let me know the solution . 但是它不支持多重身份验证,也许你们都知道,并且以前遇到过同样的问题,但如果你们有人成功地调整了同样的问题,请告诉我解决方案。

This is the scenario that i need to accomplish using Omniauth + Devise. 这是我需要使用Omniauth + Devise完成的场景。

we have a user named John and he already have accounts in both Google & Facebook with the same email id "John@yopmail.com". 我们有一个名为John的用户,他已经在Google和Facebook上拥有相同的电子邮件ID“John@yopmail.com”。

So for the first time John trying to log-in with his Google account, john have successfully logged in this time. 因此John第一次尝试使用他的Google帐户登录,这次john已成功登录。

but for the second time john trying to log-in with his facebook account, this time our application redirects john to the devise registration_url , without letting him signing in with his facebook account. 但是约翰第二次尝试使用他的Facebook帐户登录,这次我们的应用程序将john重定向到设计registration_url,而不让他用他的facebook帐户登录。

I know why this is hapepnig because devise will internally validates the uniqueness of email.But i am very curious to know that , is there any way to tweak this issue so that we can achieve multiple authentications . 我知道为什么这是hapepnig,因为设计将在内部验证电子邮件的唯一性。但我很好奇,有没有办法调整这个问题,以便我们可以实现多个身份验证。 Stack-Overflow have done the same very nicely. Stack-Overflow也做得非常好。

Please help me to find out the solution. 请帮我找出解决方案。

Thank you.. 谢谢..

try this, in your devise.rb file comment this line or change email and use difference for that and then try 试试这个,在你的devise.rb文件中注释这一行或更改电子邮件并使用差异然后尝试

  # to authenticate or find a user. Default is :email.
  config.case_insensitive_keys = [ :email ]
  # modifying a user and when used to authenticate or find a user. Default is :email.
  config.strip_whitespace_keys = [ :email ]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Omniauth进行Facebook和Twitter身份验证的Devise中的登录错误 - Signin error in Devise with Omniauth for facebook and twitter authentication 使用Devise和Omniauth进行Rails 4 Facebook身份验证 - Rails 4 Facebook authentication with Devise and Omniauth 通过Facebook Omniauth进行设计-如何使用API​​进行身份验证? - Devise with Facebook Omniauth - How to authenticate using API? Facebook,LinkedIn和Google的Oauth2登录已停止使用Devise和Omniauth,但仍适用于LinkedIn和Twitter - Oauth2 Login for Facebook, Linkedin and Google Stopped Working with Devise and Omniauth, But Still Works for LinkedIn and Twitter 如何在使用devise + omniauth + rails 3时清除facebook会话和cookie? - How to clear facebook session and cookie when using devise + omniauth + rails 3? 将omniauth-twitter gem与devise和rails一起使用5 - Using the omniauth-twitter gem with devise and rails 5 带有 devise 身份验证失败的谷歌omniauth rails - google omniauth rails with devise authentication failure 在Devise,Rails 3,Omniauth中仅使用omniauth(twitter)登录 - Using only omniauth (twitter) sign-in with Devise, Rails 3, Omniauth Rails 5,Devise,Omniauth,Twitter - Rails 5, Devise, Omniauth, Twitter Devise + Omniauth + Twitter + Rails 4 - Devise + Omniauth + Twitter + Rails 4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM