janko / janko.io

My blog
https://janko.io
8 stars 7 forks source link

Social Login in Rails with Rodauth | Janko Marohnić #40

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Social Login in Rails with Rodauth | Janko Marohnić

OmniAuth provides a standardized interface for authenticating with various external providers. Once the user authenticates with the provider, it’s up to us developers to handle the callback and implement actual login and registration into the app. There is a wiki page laying out various scenarios that need to be handled if you want to support multiple providers, showing that it’s by no means a trivial task.

https://janko.io/social-login-in-rails-with-rodauth/

stephanelpaul commented 1 year ago

swap out omniauth-google_oauth2 for omniauth-google-oauth2, the previous is outdated and is using omniauth 1

janko commented 1 year ago

@stephanelpaul Thanks, corrected ✅

34code commented 10 months ago

facebook now doesnt provide email and name unless your app is whitelisted.. new apps have to go through approval process I believe..

Is it possible to do:

account_from_omniauth {}

for facebook and the below for others?

account_from_omniauth { account_table_ds.first(email: omniauth_info["email"]) }
janko commented 10 months ago

Yes, I believe the following should work:

account_from_omniauth do
  unless omniauth_provider == :facebook
    account_table_ds.first(email: omniauth_info["email"])
  end
end
34code commented 10 months ago

thank you!