In rails, how can I import a user's facebook contacts when they sign up? - ruby-on-rails

I have a signup form, and I wanted to make it so that they have the option of recommending this signup to all their friends in facebook.
Is there a rails API/gem for doing this?
Is there an appropriate name for this?
Thanks!

Looking at the Extended permissions documentation, you don't get access to the email addresses of a Facebook user's friends (search for email and note the second column reads not available). If that's what you're trying to achieve, it's almost certainly not possible, without the user contacting each friend and asking them to visit your app (which I would imagine would have quite a low take-up, if only through inertia).

I guess you have two options:
popup a javascript before submitting the form to prompt the user wether he wants to share it with friends. You will use the js api http://github.com/facebook/connect-js (see the dialog section). This solution would avoid doing server side connection to the facebook api
Have a look a the Facebooker gem to do a stream_publish

Related

Rails gem for token authentication of outside data?

I'll describe my question through my use case -- I (using the tweetstream gem) receive and process tweets on a push basis, and for some of those events, I reply to the user with a link to a signup form for my website. Currently, users have to do auth via twitter on my site before they can submit the sign up form so that I can securely verify that they own that twitter account they claim to be.
However, that is preventing a lot of conversion, so I would like to remove the login with twitter step. My thought then, was that on receiving an event, I could hash their twitter user_id with a random string I store, and add that hash (token) as a query param on the signup link. The link would autofill the token into a hidden field in the signup form, thus (I think?) allowing us to verify the user's twitter id again on form submission.
The one caveat to this is someone could use another user's signup link and appear as them, but this isn't a concern in our case because due to the nature of the signup data. Doing that maliciously wouldn't make sense, and doing it unintentionally, we can do by displaying the apparent twitter handle prominently on the form. Account access post signup will still require login with twitter so that isn't an issue either.
So my question then is, does this seem like a sound approach, and are there any rails gems that have this functionality or would be useful? (Basically a custom version of how authenticity token protection works I think) Thanks!
I think a better approach is not having a signup form and instead simply letting people login using twitter. Is there really something you need them to manually fill in on the signup forum that you can't automatically retrieve when they login with twitter?

Facebook Connect - simply add a user's Facebook profile url into database via Rails

I'm coding a simple app which should use some FB connect mechanics but I don't want too much overhead here so maybe you can share your thoughts/experience on my task:
merchants can post products they want to give away for free
users can register for the article and get into a raffle
Once a user enters the page, I want the page to connect to his FB profile URL (facebook.com/username). User hits a "Add me to the raffle" button, the FB profile URL gets stored into my model. The merchant or a cron choses the FB profile URL randomly, displays it and lets the merchant connect to the winner (this I realised already).
This is what I've done so far:
http://limitless-brook-6233.herokuapp.com/ads/1
as you can see, I realised it via email addresses which get shuffled by the merchant. This is not very clever since FB profiles are somehow more unique and everyone can participate only one time.
What is the smartest way in your opinion to retrieve a user's Facebook URL and store it into my database? I just need to attach it to some text/input field (non editable) and let the user hit that button.
Thanks for any support.
You need to use Facebook login, take a look here
https://developers.facebook.com/docs/facebook-login/
or here
https://github.com/mkdynamic/omniauth-facebook
for the second one use version 1.4.0 as 1.4.1 has ome annoying bugs.

RoR Facebook Canvas App user Registraton & Login

I'm currently working on a RoR app that is only going to be used inside the Facebook Canvas. To model the users I use Devise. Now, I'm aiming at making the signup & login process easy as pie. If my prospective users open the app, he/she should be prompted to authorize the app to access name and email. If this happens a user should be created with the name, fb_uid and email. Every time this user now comes back to the canvas app he should be signed in.
How do I accomlish this?
Please help - looked at koala, omniauth, the javascript and php sdks -> my brain just feels fried...
This railscasts episode shows you how to easily put together the authentication system using omniauth-facebook. I actually just used it today as well. Let me know if you have any more specific questions.
http://railscasts.com/episodes/360-facebook-authentication

Symfony2, HWIOAuthBundle and FOSUserBundle - how to create users

My goal is to use these bundles to connect to MailChimp OAuth or Facebook (not necessarily as a login option but that could come later - right now just want my app authorized to access the MailChimp API) - I've got the whole process somewhat working in the sense that I can be redirect to MailChimp or Facebook, allow my app and the I am always redirected to to my failur_path as defined in my security.yml. I presume this is correct behavior since I do not have users with the matching tokens. My question is... how do I create these users in the first place? Or rather how do I get the provided oauth token into the user's data for later user/authentication?
Thanks
I know it's old, but in case someone didn't find it:
https://gist.github.com/danvbe/4476697

Tweet from my website without prompting any window and requiring any authentication - Is it possible?

I'm developing a personal project in which many users join a certain project and are able to view the information on it. Besides that, I'd like to be able that a user could tweet to the other users, warning he is online.
E.g.: user1, user2 and user3 share a project. If user1 is online, but user2 and user3 aren't, user1 would then click a button that would send a tweet (e.g., "#user2twitteraccount User1 is online!") to user2 and user3. The tweet sender would be an account of the website, not user1's Twitter account.
Is that possible to be done? 'Cause, from what I've seen so far, there are two options that are mainly used:
1) The "share button" option (Requires authentication): there is a share button, which sends a tweet on the user's timeline. It prompts a screen so the user can write whatever he want to tweet.
2) The "authorization-required" option (Requires authentication and application authorization): an application tweets on behalf of the user on his timeline.
Besides the things that I have stated, the main thing that bothers me about these options is that they tweet on behalf of the user on his account. As I am looking for a solution on which, instead of using the user's Twitter, the user would tweet throughout my site's Twitter, they doesn't work for me.
Am I missing to see something quite obvious in here, or what I want to achieve isn't quite usual? Do you know any ways that I could achieve this solution? Thanks.
I believe your best bet would be to use the Twitter web intents
You could then tweet to #user2 and #user3 from the account of #user1 adding a via #appname to the tweet text.
NOTE: #appname should be the twitter account of your app.
If this is unsatisfactory, then you should do what sarnold says as that would be the best option
(Only suggested the intents thing because you want to avoid requesting authorization)
You'll want to use the REST API.
Register your application and then POST tweets as you want to send new messages.

Resources