facebook API permissions - iphone

Just starting out with Facebook's API. I have a client that sends me the access_token after logging into to FB on iPhone. I am wondering where I would specify the permissions I need, for example to access email, or user's music data?
Is it via client using FBSession, or via Koala (ruby gem I use on server side with access_token to get user's info) or in Facebook's app settings page?
Thanks

If your user is logging in via an iOS app, you need to request them in the permissions parameter of FBSession. https://developers.facebook.com/docs/reference/ios/3.1/class/FBSession#permissions

Although I'm not a specialist in mobile development, so I cannot provide you with a functional example (or even properly explain how to do this) I have done a bit of browsing in the Facebook API section of the Developers website, and I believe that I have the answer to your questions. This will not only answer where, but it should also give you how, for many different purposes, there are different permissions that you must add, and this page gives you some idea of how to do all of them.
http://developers.facebook.com/docs/reference/login/

Related

Having permission for read_stream, manage_notifications, publish_actions

Okay, this is a rather specific question but I'll ask it here since I don't find any form on FB's website, this looks like it's the official place for FB support so here I am !
I am a part of a company which produces a unique web application for visually impaired people. Long story short, we take content from a bunch of websites and webservices and centralize everything in a single application, which is accessible, vocalized and controllable using the keyboard.
We would like to add a Facebook client to the application, using the Graph API. To make an acceptable client we would need "risky" permissions such as read_stream and manage_notifications, but I read that they are only granted for Facebook Clients written for a platform on which a FB client does not already exist.
So here is my question : do I have any chance to have any of these permissions granted, or am I wasting my time developing an app which will never be approved ? In order to submit the app for reviewing I must start to write it, and I wonder if it will be worth of my time.
Thanks :)
As WizKid stated, read_stream and manage_notifications are not granted to anyone but are kept in the documentation for legacy purposes.

Anyone know of a good tutorial for Facebook authentication?

I'm linking my app to Facebook, and would like people to log in with their Facebook account, but I can't figure out how to do this. I had read up on Facebook Connect, but it seems that that's not used any more - but every tutorial I can find seems to refer to it. When I try to follow them, it doesn't work, because the interface has changed.
So, can anyone direct me to a tutorial or guide to doing this the new way?
Basically, what I want to do is this:
A user who is signed into Facebook and comes to my webpage is automatically logged in to my app (with the usual Facebook 'granting permission' windows etc), or can sign in with their Facebook account if they're not already logged in.
I then want to use Facebook to link users with their friends who are also registered on my site, so they can share things.
I would also like to have access to Facebook comments made on wall posts from my site - so the comment stream for a particular post can be seen on my site as well as on Facebook, and comments can be made on either.
If anyone can point me in the right direction (or even tell me what I should be typing in to Google!) I'd be very grateful.
Thanks.
Some sample apps that do many of the things you speak of are shown here. The Graph API is probably your best bet right now for delivering the content and access you need and there are numerous tutorials online for how to use it, including the Facebook Developers site itself.
You will find good Tuts on ThinkDiff, e.g.
http://thinkdiff.net/facebook/new-javascript-sdk-oauth-2-0-based-fbconnect-tutorial/
http://thinkdiff.net/facebook/php-sdk-3-0-graph-api-base-facebook-connect-tutorial/
http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development-php-sdk-3-0/
I know this is an older question, but the current method for authentication is OAuth 2.0.
Facebook provides a pretty good outline of what steps are necessary in this Reference:
https://developers.facebook.com/docs/authentication/client-side/
This example allows the authentication to occur entirely in Javascript on the client side so that you can request a potential user to authenticate via Facebook and then confirm access to your application.
If the user is already logged in, only the access confirmation for your application is performed.
If the user is already logged in and access has already been granted, the user is not required to login, or reconfirm access.

Social Media Linking

I've done a little searching and was wondering if there is a way to link a users account in our web app with their social media accounts they choose to link (facebook, twitter, etc). i.e. when they log into our web app they are auto logged into facebook, twitter, etc?
I see facebook has an api to login to our web app using their facebook book account but I want it to work the other way around, I want them logged into facebook when they log into their account via our web app.
Thanks,
Ryan
It is definitely possible-from your question I assume you would like to pull data and make actions on behalf of a user? If so, you will need the offline_access permission as well as all the other permissions you will need (check out the list here to see exactly which ones you require). Then, you can trigger a script on your server that tell facebook as soon as the user is logged in to your site, to log in your application as the user as well.
NOTE: You might be going about this in the wrong way. I would advise that you specify a bit more details on what exactly you need the user to be logged in for, and I can (probably) provide you with a decent answer.
EDIT: In response to your question in the comment, Ryan, here is my answer:
You need to divide this problem into 2 different situations-one: your company wants you to write all the code from scratch and don't use what facebook has to offer, in which case you should create a custom login script that enables your users to use their facebook account as the Actual user account in your web app. This is the best solution in my opinion, and is supported by the ever-so-awesome Jeff Atwood. Here's a link to how to do just this, and a tutorial about this also.
Or your company is comfortable with using Facebook's Social Plugins.
Then you should focus on Like Button & Comments : These social plugins are the best way to enable people to create social experiences if they're already logged in.

How to do Facebook places search without user facebook authorize

I am still new to Facebook Graph API, and trying to start using facebook places search. (search places by location)
https://graph.facebook.com/search?type=place&center=37.76,122.427&distance=1000
One thing i have noticed is user have to login to their Facebook account to do the search, otherwise the search will be rejected.
Could anyone shine me some light pointing a direction to work around this?
Any links or articles will be appreciated.
Thank you
Yeah, unfortunately I think this is a design flaw (or feature?). By this design, only Facebook authentication users can search for places. Others cannot. It seems more like a capability designed to serve end users than actual apps.
The flaw I see is that many applications out there are trying to offer optional Facebook integration but don't make it obligatory. Unfortunately, as it stands now, the places API can't be used as a service for apps just additional functionality for FB users.
What you are trying to do is not possible. Per the error message: "An access token is required to request this resource." Most of the graph api requires an authenticated user (ie an access token) to make requests. There are only a few calls that can be made without the access token and this is not one of them.

Outside access to Facebook events

Let's say I own/control a Facebook page where events are posted. I'd like to display these events on another website (In my case, a WordPress blog, but that's not the important part) on an "Upcoming events" page.
What I'm unsure about is: Is the Facebook API usable "externally" like this? I've downloaded the PHP library and have a demo app running that works from within Facebook (i.e. emitting FBML that facebook.com interprets and displays to the logged-in user), but in my case I want a third party (my web server) to query Facebook every so often, rather than the site visitors directly requesting data (HTML/JSON/etc.) from Facebook itself.
Is this sort of thing possible with the Facebook API? How will my web server authenticate itself? What information do I have to store?
Note: I'm looking for information more at a "sequence diagram" conceptual level, not just asking for code. That part I can figure out myself. ;) Unfortunately, Google and the FB developer wiki have not been entirely forthcoming. What do I need to know so I can start coding?
This is a basic overview of how I've done it for a few of my clients who wanted similar functionality:
Create a pretty basic app that prompts for Extended permissions, specifically "offline_access" and whatever else you need
Store the resulting Session Key in your database with the UID
Create a secure, authenticated webservice for your app which allows you to get the info you need for a UID that you supply, using the session that you've stored in your database
On the website make requests to your app's webservice, being sure to cache the results for a certain period of time and only make a new request to your webservice once the cache has expired (I use 5-10 minutes for most of mine)
So basically your Facebook app acts sort of like a proxy between the website and the user, doing all of the authenticating and requesting using legitimate means.
I've used a webservice because I only wanted to maintain one Facebook app for multiple client's needs. It works like this (in a not-very-awesome ASCII art diagram):
Facebook User 1 \ / Client Website 1
Facebook User 2 --- Facebook App --- Client Website 2
Facebook User 3 / \ Client Website 3
Note: I've only done this for users, not pages, so your mileage may vary.
You can do Events.get with the Facebook API then supply the page/profile ID you'd like to get the events for. Depending on how your page is setup you may have to authenticate, simply use your Facebook account, since you should have access to all the events. oh and make sure you do plenty of caching so your not hitting Facebook on every page load.
AFAIK other than user info, you can't fetch any other data from facebook.
But you can try it other way - say create an app that stores events and other relevant information on a webserver and then your other website can easily access that info.