简体   繁体   中英

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

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.

we have a user named John and he already have accounts in both Google & Facebook with the same email 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.

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.

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 . Stack-Overflow have done the same very nicely.

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

  # 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 ]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM