Skip to main content

Remove omniauth and convert existing users

Gems / Libraries • Asked by Nino Rosella

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


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.


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!


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.


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


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 20,000+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.