2

If I use the modules :registrable and :omniauthable, I'm not clear whether I can do the following. If not, how can I?

My application allows users to both signup/register and signin through oauth and devise.

My Oauth provider gives everyone a unique user_id. I would need to store that user_id in my Devise User record.

When a User who has registered signs in, Devise should check after Oauth athentication, whether the user_id exists.

Ideally -- it seems that the user shouldn't need to select sign in versus sign up: if the user_id from the provider doesn't exist, it should take the user through the New User registration process after Oauth authentiction.

Can someone show me an example of this type of signin/registration using Devise and Oauth (I assume via Omniauthable).

Satchel
  • 16,414
  • 23
  • 106
  • 192

1 Answers1

0

Take a look at my answer at another Stackoverflow thread. In my example it is automatically decided, wether a user is new (and an account has to be created), a user exists (a new authentication is added) or a user just wants to log in.

Community
  • 1
  • 1
Markus Proske
  • 3,356
  • 3
  • 24
  • 32
  • 1
    hello, it looks like your code isn't using the :omniauthable module....just the :oauthable....I only want to authenticate with a single provider, but still, from what I've read, it sounds like omniauth is the way...how does this fit with that? – Satchel Mar 26 '11 at 21:54