Topic: omniauth + email&password registration
(in this question I'm asking the same thing I'm asking here http://stackoverflow.com/questions/7247 8#7255898)
what is the best practice to combine facebook sign up (let's say I'll use Omniauth gem) and email+password sign up. I saw few blogs, saw the Railscasts, I know everyone is using Devise gem with Omniauth. But I'm looking for some different perspective.
This is how I saw it's done in most examples on the web
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
tihs is 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)
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
signing up with FB: you save FB uid and authKey to authentication table, then create user
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
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 or is there better way of doing that ?
subquestion: is there any gem