Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 "[email protected]".

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..

like image 616
Sreehari K M Avatar asked Oct 06 '22 02:10

Sreehari K M


1 Answers

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 ]
like image 91
Dipak Panchal Avatar answered Oct 10 '22 04:10

Dipak Panchal