devise & facebook omniauth

11 views
Skip to first unread message

Joe Guerra

unread,
Oct 4, 2018, 9:48:59 AM10/4/18
to Ruby on Rails: Talk
I've got these two working together , but I've found out if you sign up initially with facebook - the devise password doesn't exist.

and removed the confirmation to update the profile which worked, but did not update the devise password.

has anyone dealt with this and found a way around it?

Thanks,
Joe

Walter Lee Davis

unread,
Oct 4, 2018, 6:12:07 PM10/4/18
to rubyonra...@googlegroups.com
When you authenticate with an OAuth provider, you don't get a local password. If you want to change the password, you have to do that at Facebook.

Walter
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b1c677b5-0c3e-4130-ae02-8c52809da84b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Joe Guerra

unread,
Oct 4, 2018, 9:34:39 PM10/4/18
to Ruby on Rails: Talk
Ok, then I think I'm going to make a few small changes to the profile form and the login/sign up pages.

So you're either registered locally or by facebook.  I'll check for a provider in the user table, and if that exists I'll remove the password field (and maybe say that you account is registered using facebook - so they remember how they signed up.)

And I guess if they have initially they can't log in using facebook?

Thanks,
Joe

Joe Guerra

unread,
Oct 4, 2018, 9:40:06 PM10/4/18
to rubyonra...@googlegroups.com
Sorry, I guess if they have logged in using devise locally initially they can't log in using facebook?


Walter Lee Davis

unread,
Oct 4, 2018, 10:07:16 PM10/4/18
to rubyonra...@googlegroups.com
You may want to look at OmniAuth for this: https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

You can sign in using any number of different strategies, including local authentication, if you set it up right.

Walter
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMkQ2-uH2cDpo4CxVSYWgiUFtGGDg1%2Bz%3DZ5vN8%2BCz9%3DafQ%40mail.gmail.com.

Joe Guerra

unread,
Oct 4, 2018, 10:25:26 PM10/4/18
to Ruby on Rails: Talk
I believe I set it up correctly?
Take a look. 

Walter Lee Davis

unread,
Oct 4, 2018, 10:34:00 PM10/4/18
to rubyonra...@googlegroups.com
I don't have Facebook, so I can't try that angle, but you have both devise database_authenticatable and omniauth enabled in your User, right?

Walter
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9bbd9c9f-3c08-43b9-b02e-989ad75a77c8%40googlegroups.com.

Joe Guerra

unread,
Oct 4, 2018, 10:42:02 PM10/4/18
to rubyonra...@googlegroups.com
Yes, both are enabled.  

So I guess that means you can only use one or the other?

Walter Lee Davis

unread,
Oct 4, 2018, 10:49:29 PM10/4/18
to rubyonra...@googlegroups.com
You may be able to recover your password (since you don't have one to begin with) if you signed up with Facebook and then decide to move to local authentication. You could try that, if you have a Facebook account, try using the password recovery path to add a new password to your account.

Walter
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmiuBMkeq0CjBmwnVToA9pYJNTKcAdfyzMea5a7-c9G4A%40mail.gmail.com.

Joe Guerra

unread,
Oct 4, 2018, 10:54:53 PM10/4/18
to rubyonra...@googlegroups.com
Ok, I'll try that.  I had this crazy problem that I fixed before - if you created a profile using facebook you couldn't update your profile because u didn't have a local password.  lol.  I fixed that (not needing the password to update the record).

Joe Guerra

unread,
Oct 5, 2018, 2:33:38 PM10/5/18
to Ruby on Rails: Talk
I fixed up my login and sign up pages.


I also fixed the invalid token error when login out, I believe.  I added some login status to the profile page (basically where you've signed in from and removed the password field if you've used facebook to login).

Hopefully, people won't get too confused.
> > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.

> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9bbd9c9f-3c08-43b9-b02e-989ad75a77c8%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.

> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4BBAAB0E-E665-4969-9F7A-5A8225C67186%40wdstudio.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.

> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmiuBMkeq0CjBmwnVToA9pYJNTKcAdfyzMea5a7-c9G4A%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages