I have set up Devise to allow a user to register with e-mail. Now I have included a Log In via LinkedIn with omniauth. Therefore I had to save provider as well as uid in the users table.
The problem I have now, is that the combination of provider and uid should be unique. But when a user decides to register with email I don't have any values for provider and uid. How can I deal with this problem in a good way?
I am new to Rails and did not find any other answers to it.
Thanks a lot!
I would probably fill in
manual
in the provider and generate a uid withSecureRandom.uuid
.You could do this in your
User
model using abefore_validation
hook.You could also hook into the controller which creates the user.
If you need the uid to prevent a user from signing up twice with the same email, I'd use a sha256 hash of the email-address.