Ask A Question

Notifications

You’re not receiving notifications from this thread.

Remove omniauth and convert existing users

Nino Rosella asked in Gems / Libraries

Hi everyone

I have LinkedIn omniauth sign in up and working on my Rails 5 app in accordance with the Devise guide: https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

I have some active users that have signed up using LinkedIn but now I would like to remove this functionality from the site. I thought that if I simply changed the provider of a user from "linkedin" back to nil (in the console) then that user could sign in to my app using the email address they have associated to LinkedIn. When I try to change the provider on a test account the change fails.

Anyone have any ideas?

Thanks

Reply

Hey Nino!

I'm not quite sure what's happening. You'll have to define what "When I try to change the provider on a test account the change fails." means. What isn't working?

Also remember that all these users won't have put in a password, so you'll have to get all of the LinkedIn users to do the forgot your password process in order to setup passwords for them for the first time.

Reply

Hi Chris,

Sorry the question wasn't too clear - I rushed it! What I was trying to say is that in the user table I have a column named provider which stores the value "linkedin" for the LinkedIn signups. On a single record I was trying to modify the value in the rails console, but when I tried to save the record it was returning false.

Hmm I think this whole process is going to be fairly messy. This is the first and last time I ever use third-part sign up!

Reply

OAuth definitely gets tricky pretty fast, especially when some services like Twitter don't give you an email, so you can't create User records without asking and so on.

When you try it in the console, try printing out user.errors when the save fails so you can see what the errors were. It could be one of your validations failed and that will let you know what went wrong.

Reply

I can't believe I didn't think of that...

Yeah, it was a validation failing on a username column that I have.

Thanks Chris

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,651+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.