Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6531111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:50:17+00:00 2026-05-25T09:50:17+00:00

What is the best practice for combining Facebook login (let’s say I’ll use Omniauth

  • 0

What is the best practice for combining Facebook login (let’s say I’ll use Omniauth gem) and email+password login?

I saw a few blogs, saw the Railscasts, I know everyone is using Devise gem with Omniauth. But I’m looking for some different perspective.

subquestions:

I’m considering creating email+password sign-up from scratch (not using any gem for this, lets keep it fast and light) so do you have any advice for this ? Or if you have particular gem in mind, please let it be fast.

And do you have any other recommendations for Oauth2 gems (alternative to Omniauth) handling authentication to Facebook ?

I’m sorry I’m asking this fundamental questions here, but I didn’t found many answers (and most of them I found are based on Devise)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:50:18+00:00Added an answer on May 25, 2026 at 9:50 am

    This is how I saw it’s done in most examples on the web

    auth_with_devise_and_ominauth

    basicly when you signup with email+password, you are creating row directly to User model (not touching the Authent. model) and when signing up with Omniauth, than you are creating new authentication that communicates with User model.

    And basicly on next login you are doing something like this :

     if (user.password == 'xxx')
        login
     elsif user.authentication.uid == 'xxx'
        login
     else
        'hello signup !'
     end
    

    so you are swiching between 2 models, and raping (sorry for the term) the User model witch should hold only user info

    The solution, in a way, I think is correct (from my experience and discussions with my colleagues but I’m still not 100% sure this is the right answer)

    enter image description here

    as you see even the user+password is going trough Authent. model, that means the site user+password is acting as a provider on its own

    so to be absolutly correct it should be look like this
    enter image description here

    • scenario 1

    signing up with FB: you save FB uid and authKey to authentication table, then create user

    • scenario 2

    signing up with password: you create new row in AppPass table, then you create row in Authentication table (as a access to provider witch is actually your app) and than you create user

    Why?

    because now when user logs in, is always going trough Authent. model, not making condition between 2 models (the Authent. and the User model)

    now can anyone please tell me, …is this a good approach 😀 ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Best practice is to use unique ivs, but what is unique? Is it unique
The best practice seems to be to use assert for a condition that should
Is it a best practice to use more than one xib in a view
Is there a common method/best practice/any means for combining forms that span multiple related
I realize that the best practice is to use strongly typed Views and pass
Current best practice is to use Environment.NewLine in your code to, well, start a
What is the best practice for compiling a bunch of flash movie files (.fla)
Short best practice question: If an object A is injected into another object B,
The 'best practice' (as I see it) to atomically create a new file, is
What would be the best practice to keep the user logged in if he

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.