twitter connect and rails - ruby-on-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.

Related

Facebook login on iPhone. Authenticate with Rails Backend (Devise+Omniauth)

I am trying to implement a facebook user authentication in my iOS6 App through my Rails Backend running with Devise using omniauth. I am looking for a step by step guide how to setup my API and Devise + Authentication.
I only have a only have a rough knowledge about how to do that.
(on App) check if the user signs in on his facebook on iPhone
iPhone is authenticated client sided on Facebook. FB passes me his mobile auth token
I send my auth token or auth hash to my rails backend via API RESTful SSL.
Rails receives the Token and checks if it is valid. ( What command uses the least traffic against FB Graph API? with Koala Gem)
If valid. Check if the user already exists. If not, create a new user.
Create a new session.
Is this correct?
Are there any good examples?
Thank you very much.
I'm not familiar with the iPhone piece, but your approach after that is generally accurate. The only exception is that you would typically use provider + uid to find or create a user, rather than a token. That might be what you meant by your #5, but it wasn't clear to me.
Beyond that, there is a good (paid) Railscast on the subject of Omniauth + Devise, which would probably be worth the price for you:
http://railscasts.com/episodes/235-devise-and-omniauth-revised
It covers how you can receive and handle the auth hash, and it gives you a nice starting point for what your methods will look like.
if you don't access to pro episodes i have some links to help.
http://jessewolgamott.com/blog/2012/01/19/the-one-with-a-json-api-login-using-devise/
you can also look into it
http://net.tutsplus.com/tutorials/ruby/how-to-use-omniauth-to-authenticate-your-users/
Nice and easy to code
http://blog.joshsoftware.com/2010/12/16/multiple-applications-with-devise-omniauth-and-single-sign-on/
I hope these will work for you :)
http://www.orhancanceylan.com/rails-twitter-and-facebook-authentications-with-omniauth-and-devise/

Rails app connect to twitter

I am new Rails developer. Right now, I can let user register in my Rails App. I have database running also.
Todo:
After user register. I will ask permission to access his twitter. And I can access his tweets(including location information in tweets).
About this part, I have no idea how to do now? Can anyone give some links where I should start? I guess first step is I need authentication from twitter right?
Thanks
You are right, first of all you need authentication user from twitter: railscasts. Then you will find all methods there twitter api

How to update users facebook profile status from my rails web application

in my rails web application I am implementing Facebook connectivity. I want that whenever user updates his/her status on my site his/her facebook status should also be updated. Is there any working rails application for this?
Please help.Thank you.
Have a look at the Koala gem which acts as a client to the Facebook graph API and does exactly what you need.
fb_graph as well also accomplishes what the koala gem does .
Though to update on a user to user basis you'll need to have some sort of login system in place. In that case I'd look at Devise using omniauth to accomplish this.
I use devise + omniauth for authentication and getting the right access token.
I use Koala for updating + reading information.

OmniAuth to extract full profile data from LinkedIn

I'm loving the ease of OmniAuth, but I'm having a hard time connecting the dots on making additional api calls after I receive the token back.
I'll use LinkedIn as an example, but it's not LinkedIn that's the issue, more so my lack of understanding on how to make subsequent calls after I have authenticated.
I can make the request to LinkedIn and authenticate just fine.
Then I get the hash back and it's completely populated.
Now I would like to call LinkedIn back and get my complete profile data or maybe a list of contacts. How do I do this? Will I need the oauth gem after all?
I'd prefer to avoid app specific gems because I will have to make the same requests to twitter and facebook.
Omniauth is designed for authentification only.
Marcel Falliere is right. Omniauth is just for authentication.
You can have a look at this plugin, it could solve your problem.
https://github.com/pengwynn/linkedin
I think I just found out the answer to it.
after completion of oauth process with service provider(fb, twitter) omniauth saves the user. here it passes a hash to the user object and the content of hash are here https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema these credentials part can be used to request further request( infact u will have to save these in your user object).

Using Facebook Connect with Authlogic

I am trying to make Authlogic and Facebook Connect (using Facebook) play nice so that you can create an account either the normal registration way or with Facebook connect. I have been able to get the connect to work one way but logging out only loggs out on facebook and not on my site, I have to delete the cookies to make it working. Any help would be awesome, thank you!
Here's an example app I made using the Facebook Connect extension, authlogic and Open ID. It still needs some work, but it does function.
http://big-glow-mama.heroku.com/
http://github.com/holden/authlogic_openid_selector_example/tree/with-facebook/
This is a good gem for that.
http://github.com/viatropos/authlogic-connect
Have you tried the Facebook Connect extension for AuthLogic?
just tried omniauth with authlogic, that works like a charm
btw, authlogic-connect is out-dated
You also have an example app to check (Authlogic + Omniauth)
http://omniauth-authlogic-demo.heroku.com/

Resources