Ask A Question

Notifications

You’re not receiving notifications from this thread.

Facebook Profile Image & Data using Devise in Rails

Omar Khedr asked in Gems / Libraries

I'm just starting to learn Rails so please forgive the dumb question. In my web app, I was able to set up devise successfully and then link it Facebook using Omni-auth gem. However, two things occur.

1) A person who signs in using Facebook doesn't register as logged in - the Navbar still shows "Login"

2) I added an avatar so users can show their profile picture. While a regular devise user can added it without a problem. Someone who logs in with Facebook doesn't have their image displayed.

Any help that you guys can give me would be so amazing, I feel like the issue might be in my user.rb file. I have listed below all my relevant code and my github url. Thank you again :)

Github-url: https://github.com/OmarZV/TY2

Reply

I'm not quite sure on #1, but as for #2, you've got paperclip which wants an actual file. Facebook's API is only going to return you the url of the file, so you've got to tell Paperclip that you want it to download the file from the URL.

    user.image = URI.parse(auth.info.image)

You'll want to modify your User method like this in order to actually assign a URI object to the image which Paperclip will know to download.

http://stackoverflow.com/questions/4049709/save-image-from-url-by-paperclip

Reply
Join the discussion
Create an account Log in

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

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

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