How to integrate facebook comments in Rails application? - ruby-on-rails

I've set up a Rails 3.2 application with Devise. I was wondering how I can allow users to comment using Facebook. Can I use facebook connect along with Devise? If I can, is it ok to have 2 methods of authentication on my site?
I've read some tutorials on setting up OAuth with Devise to allow facebook connect, but it's not all that clear to me. Does anyone know a good step-by-step tutorial on how to integrate facebook comments with Devise already set up? Thanks a lot!

You don't need to setup Facebook Connect for comments.
You have to first create a Facebook app, then generate the comments plugin. After, put the Javascript code in your application.html.erb after the body tag (my suggestion is to make a partial). In the end, drop the div with the fb-comments class where you want the comments box to appear.

Related

Devise OmniAuth and Devise-otp

I am new to rails.
I want to do a google authentication app using Devise gem. (i.e) SignIn with Google after successful login by user and then I have to display otp view page (using Devise-otp gem)
Is it possible to implement those 2 features using Devise Gem in single app ?
If Possible can give me some tutorial links or some steps.
I completed Signin with google after that I don't know how to use Devise-otp to proceed second-step-verification process. so please help me.
I referred below links but it confused
https://github.com/AsteriskLabs/devise_google_authenticator
http://www.techhui.com/profiles/blogs/add-two-factor-authentication-to-your-rails-app-with-devise
You can use active_model_otp gem for this purpose.
Active model otp

Omniauth and LinkedIn: Step 3

Can anyone help with LinkedIn's instructions for setting up omniauth.
I'm really struggling to understand how to set it up in my Rails 4, Devise, Omniauth app.
I'm currently getting this error: Invalid redirect_uri. This value must match a URL registered with the API Key.
The LinkedIn Developer instructions suggest this is an error with Step 1. I have registered my app.https://developer.linkedin.com/documents/authentication
I don't understand how to do step 3. Where do I put the redirect code? How does it work with the rails config. Please can someone help.
Thank you
Basically the step 3 it's saying that you can ask for different permissions in each request by the url, but for your gem you should not worry about this, just skip to the configuration(step 4) of your app in linkedin(settings) and select witch permission to use with all users, this will trigger ask the same for all the user of your page.
Now if you really want to have different behaviors for each user, lets say some users will just login and other will manage their linkedin profile thought your page, you should change the behavior of the workflow of omniauth, facebook-omniauth-gem have an option called setup that you can pass into config.omaniauth in devise initializer, this will trigger an extra step to change the url and there you can put that options, i imagine that linkedin should have something similar.
I just do an answer for facebook, but i explained for general use, look at that if you have troubles, regards!

how to share fixed data on facebook if used omniauth for authentication

I have used omniauth for authentication of user in rails. i just want to create a button on my site which when clicked should post to logged in users facebook profile a certain fixed data.
i have tried facebook_share gem but unable to specify the predefine text. kindly help me in this
thanks in advance
In place of facebook_share the better way is to use facebook api. link explains all
https://github.com/aayushkhandelwal11/training-assignment/blob/master/facebookshare.txt

twitter connect and rails

I am reading this tutorial: http://blog.dhavalparikh.co.in/2009/06/step-by-step-twitter-oauth-integration-with-rails/
OK, first redirect to twitter connect page. When I allow the connection, twitter redirect to https://twitter.com/oauth/authorize with a code for connect but this must redirect to a action which connect and create a new user in my db.
SO which could be the problem? How i must config the twitter application callback url and app url for localhost.
please i need this answer
Thanks in advance
This doesn't really answer your question but is a nicer way to do this.
Omniauth is a nice gem for rails that makes it very easy to offer twitter, facebook etc. login.
A good intro to this was created by Ryan Bates of Railscasts.
The problem is: Twitter send the token information via post. SO i receive the token by params.
Also there is a problem with oauth 0.4.
I am using oauth 0.3.4 because work in the correct form when twitter try redirect to callback url.

Rails 3 and Devise: Omniauth vs. Facebook Connect

I am currently using Devise+Omniauth on my Rails 3 app to authenticate users. My client saw this and doesn't like how omniauth redirects you away from the site. He wants something like on digg.com, which I believe uses facebook connect to authenticate (and opens in a popup instead of redirecting).
What are some arguements for my client to keep him using the Omniauth method? Why is it better than Facebook connect.
And failing that, are there any good resources for logging users in with a facebook connect popup window? Or really anything involving facebook and a popup.
Thanks!
OmniAuth supports login via the Facebook Javascript SDK, which works through a popup. You just need to include the right files. I don't remember all the details, but this should help:
https://github.com/intridea/omniauth/issues/120

Resources