Facebook open-graph for iOS? - iphone

I'm trying to implement like in the open-graph API for facebook. I've created a like on the facebook admin page.
I'm logged in on the device with the same account that is the admin for the app on Facebook.
There is a valid token in the application, I have the right permissions.
I've also added the necessary tags on each page that is going to be liked.
This is the code snippet that's trying to post:
[appDelegate.facebook requestWithGraphPath:#"me/app_namespace:like" andParams:md andHttpMethod:#"POST" andDelegate:appDelegate];
The error message I'm getting is:
code = 2500;
message = "Unknown path components: /guidepal:like";
type = OAuthException;
What could the problem be?

The best thing to do is to follow my answer on this link: Facebook iOS SDK 3.0, implement like action on a url?
It should work perfectly fine on lower facebook sdk:s to if you have saved the access token.

Related

how to get like status of facebook php sdk

I am making event page on facebook by using facebook php sdk.
i added fb app to fb page.
the page was made for fb event.
i tried some ways. but all failed.
Now, i will make two pages.
one is after clicking like.
the other is before clicking like.
i use this soruce to get userf id.
$user = $facebook->getUser();
it is to get user id source.
i want to know to get like status.
how can i get like status about facebook php sdk.
please let me know it. ^^ plz
If it is a page tab app the signed request will contained a liked parameter. You can read about it on https://developers.facebook.com/docs/appsonfacebook/pagetabs

FacebookOAuth exception

I am new to Facebook. I am developing an app to post to news feed on my facebook page.
First I authenticate and once I authenticate, I use FacebookClient object to get facebook id as well as name. This is working fine.
I have button click event which does post to news feed. and it is returning the following exception.
{"(OAuthException) (#200) The user hasn't authorized the application to perform this action"}
I am following the sample code from http://facebooksdk.codeplex.com/wikipage?title=Code%20Examples&referringTitle=Documentation
-> Post Publish
Where can i set in the facebook to allow the application to post?
thanks
Venkat
Take five minutes and get familiar with: http://developers.facebook.com/docs/guides/web/#plugins
Specifically with:
<fb:login-button perms="email,user_checkins">
Login with Facebook
</fb:login-button>
and http://developers.facebook.com/docs/authentication/permissions/
Hint: publish_stream

Can't figure out how to get access token using facebook c# sdk

I'm currently writing a Facebook app that runs in a page tab. I'm writing it as a simple Web Forms app in C#, using the latest version of the C# SDK pulled from NuGet. The main page tab works fine. I get all the info I need from FacebookWebContext.Current.SignedRequest, and I'm fine there. I'm trying to write a page now that the page admin would use to set up the app, so this is the page that would go under the "Edit URL" in the app setup.
All I really want to do is get the currently signed-on user's ID, and determine if he's an admin for the page in question.
I'm doing this:
var client = new FacebookClient();
dynamic me = client.Get("me");
in Page_Load, and getting the following exception:
(OAuthException) An active access token must be used to query information about the current user.
I've tried a bunch of stuff to get the access token, but I don't seem to know what I'm doing wrong. Is there a straightforward way of doing this?
Update:
I figured out at one point that I had a reference to the old JS SDK on my master page, and that was causing a problem. (See here). Removing that got me to the point where I was usually able to see whether or not the user was actually logged in to Facebook.
Try this:
var fbContext = FacebookWebContext.Current;
if (fbContext.IsAuthenticated())
{
var client = new FacebookClient(fbContext.AccessToken);
dynamic me = client.Get("me");
}
As far as I understand, being logged-in in Facebook does not mean FacebookWebcontext.Current.isAuthenticated() == true. What Facebook wants to make sure is that the user has authorized the app. So what you should do is to forward the page to facebook authorization dialogue page (https://www.facebook.com/dialog/oauth?) with necessary permissions. Facebook will determine whether the app has been authorized by the user and redirect to the redirect_uri with a newer access_token issued.

Facebook C# SDK for Facebook Connect

How can I use Facebook C# SDK for facebook connect using ASP.NET?
What I am trying to do is:
Provide a "Login with Facebook" button.
Once the user clicks on Login button, get the access token on server side and sign in to my website.
Most articles (I found through google or SO) said use Facebook Javascript SDK for Log in and Authentication and then get the Access token from cookies created on web browser.
What I did so far:
Used Facebook login button in .aspx page with the below code.
<fb:login-button onlogin="window.location.reload();" perms="offline_access">Login with Facebook</fb:login-button>
Problems I am having:
When I click log in button on MY PAGE a window will pop up to log in to facebook. MY PAGE is supposed to reload when I login to facebook but it reloads even I click on Cancel button or close the pop up window. What I need is reloading MY PAGE only when I log in.
From the above step: If I log in and MY PAGE reloads perfectly. In code behind (Page load event) I can see the cookie created and it has the information (access token) what I needed. And from here I want to use Facebook C# SDK to get user information. how to do ?
I used Facebook C# SDK 3 months ago for developing a canvas application in Facebook. The documentation and examples listed on Codeplex are for Apps on Facebook (correct me if I missed to see facebook connect examples). Also, there was a link to documentation which lists all the Facebook C# SDK classes but I could not see that now. Please provide me the link if you know.
Any help will be greatly appreciated.
Thank you.
http://blog.prabir.me/post/Facebook-CSharp-SDK-Writing-your-First-Facebook-Application-v6.aspx
But there is one issue I am not using
parameters.response_type = "token";
Instead of that i have function to update Token
public static void UpdateToken()
{
var fb = new FacebookClient();
dynamic result = fb.Get("oauth/access_token", new
{
client_id = AppId,
client_secret = AppSecret,
redirect_uri = Url,
code = FacebookUtils.FacebookData.Code
});
FacebookData.AccessToken = result.access_token;
}

Facebook for iPhone, background wall post

I am implementing the Facebook iOS SDK into my app... and find no problems with that. BUT, what I can't find to figure out is how to send basic wall post to my facebook app wall.
What I want to do is whenever a user searches for something, the app sends a wall-post with the following text "#someUser just searched for someSearchQuery" to my apps wall (not the users wall).
Offcource this is something I want the user to be able to switch on / off in the settings page, so the user is aware of it.
How can I do this?
Best regards,
Paul Peelen
Use the new Graph API as described here:
http://developers.facebook.com/docs/api#publishing
Quoting:
"For example, you can post a new wall post on Arjun's wall by issuing a POST request to https://graph.facebook.com/arjun/feed"
To use the Graph API from Facebook iOS SDK do something like:
[facebook requestWithGraphPath:#"[your app's id]/feed" andParams:params andMethod:#"POST" andDelegate:self];
where params is a dictionary with following optional keys:
message, picture, link, name, caption, description, source