Facebook authentication without requesting friend list - asp.net-mvc

I'd like to use Facebook OAuth authentication for a web application in a business context. What I need is a user ID and nothing else but Facebook by default always says "... will receive the following info: your friend list and email address".
Is there any way to configure Facebook or my application not to request the friend list for which I have no need to know?
By the way, I am using ASP.NET MVC but should be able to make the required adjustments to my application if someone can point me into the right direction.

If you are using Microsoft.Asp.net.Facebook like below tutorial
http://www.asp.net/mvc/tutorials/mvc-4/aspnet-mvc-facebook-birthday-app
You can set the attributes like below to get permissions for required things:
[FacebookAuthorize("email", "user_photos", "user_friends")]
if you don't need friends details remove the attribute.
[FacebookAuthorize("email", "user_photos")]

Related

how to get facebook user id or user name with email id

I am developing a MVC project where I am trying to get the user id or user name from the facebook by using the email id provided by the user,
actually i want to fetch the photo of the user, which can be done using
graph.facebook.com/user_id|user_name/picture
where as i have only have the user email id.
with a little surfing on net i found that user name or user id can be fetched by using
graph.facebook.com/search?q=emailAddress&type=user&access_token=ACCESSTOKEN
but i was not able to get the access_token.
Also referred
developer facebook page
and also this
Any help or direction to work will help indeed.
Basically i understand that i need a access token to get the details.
So how do i do this in my MVC application
As you can read in the Search API docs, you can only search for Users by name, but not by E-Mail. It may have been possible in the past, but it is definitely not possible anymore.
Also, for searching by name, you need to use a User Access Token. You only get one by authorizing a User: https://developers.facebook.com/docs/facebook-login

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

Getting Facebook Public Profile URLs

I'm building a feature in my web service to let people enter their Facebook URL into a field. Because few people know their FB user names or public profile URLs, I'd like to provide an interface to assist.
In brief: is there a way to get a list of matching users's public URLs by providing a name alone?
I have tried examining the Facebook Open Graph API; this appears to require knowing the user ID of the person, or the user ID.
I have tried using Mechanize and Nokogiri to automate the process, logging into Facebook as myself and accessing the search feature (http://facebooks.com/search/results.php?q=Person%20Name), but it's not returning any data when attempted this way. I suspect Facebook is using some kind of joojoo to keep me out that way.
Anyone have any suggestions?
With a valid access token, you should be able to query https://graph.facebook.com/me/ to get their ID, name, and public URL (Here's an example using the Graph API Explorer).
There's a search endpoint in the graph API, unfortunately it requires valid user access token.
https://graph.facebook.com/search?q=<name>&type=user&access_token=<user access token>
However it could be yours even, by getting a long living access token it would work for 60 at most, but it's probably a bad idea.
The type could be user, post, event, group, page.
Having done additional research, it appears to not be possible to get a user's public profile page without their permission. Hooray for Facebook privacy settings, I guess.
However, getting an access token is easier than I imagined it would be. Facebook offers an example on their site for getting user permission to access their account, implemented entirely on the client side. Nice and easy; the access token is returned in the URL.
The only downside here is you have to create an application on Facebook, at http://developers.facebook.com/apps. For my purposes, the "Website with Facebook Login" was the application type.
From that point, you can use that token to interrogate the Graph API with ease, as both Warpling and complex857 have suggested.

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

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

RoR - How to obtain an access token for the facebook user using OAuth?

i want create something like "link_to" which can link to "request for permission" in facebook, so if user click "allow" then redirect to my site and i can get their data.
my question is how to create a "link" like that? so i can get access token from facebook user. (i had register my app)
thx..
Better explained here:
http://ggomeze.com/2011/05/19/post-to-facebook-from-rails-app
It's quite simple. Just redirect the user to the Facebook Auth Page:
https://graph.facebook.com/oauth/authorize?
client_id=...&
redirect_uri=http://www.example.com/callback&
scope=user_photos,user_videos,publish_stream
There're several optional parameters you can pass to get the required site.
For further Information just read the corresponding paragraph on the Facebook Documentation ("Authenticating Users in a Web Application"):
http://developers.facebook.com/docs/authentication/

Resources