I am trying to send a Facebook notification from my app using Graph API Explorer. So I have selected my app, POST, and entered this string after the /
I'm also trying to post a notification, using the graph api. I first request the app access_token, which is properly returned. I use it then as a parameter of the notification request, like it should be done. But still, I get this same error message "This method must be called with an app access_token"... and Yes, the app is configured as a Web Application.
That was fun for the first five hours, but it's getting a little bit annoying...
any other idea, world? please?
EDIT: I've been fighting with this issue for the whole night and the following morning, I eventually decide to give it up. There is definitely a problem I don't understand with this API, and I'm not able to find any solution anywhere.
A few details about what I do, in case someone comes up with an idea :
it's an iOS app, using the Facebook iOS SDK. Login, authorizing, getting friends profile, posting a message to my wall : everything is working properly.
Then, in order to send a notification, I first send a request to retrieve the app access token.
NSDictionary* parameters = @{@"client_id": [THE APP FACEBOOK ID], @"client_secret" : [THE APP FACEBOOK SECRET], @"grant_type" : @"client_credentials"};
NSURL* feedURL = [NSURL URLWithString:@"https://graph.facebook.com/oauth/access_token"];
SLRequest *feedRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:feedURL parameters:parameters];
feedRequest.account = self.account;
[feedRequest performRequestWithHandler ... ]
The request answers :
NSString* tokenString = [[NSString alloc] initWithBytes:[responseData bytes] length:[responseData length] encoding: NSUTF8StringEncoding];
NSArray* chunks = [tokenString componentsSeparatedByString: @"="];
NSString* appAccessToken = [chunks objectAtIndex:1];
NSLog(@"appAccessToken '%@'", appAccessToken);
That seems to work as expected. I get :
appAccessToken '1309[HIDDEN]|-eta-nuWz[HIDDEN]'
Now, I try to post the notification
NSDictionary* parameters = @{@"href": [myHref absoluteString], @"access_token" : appAccessToken, @"template" : myMessage};
NSURL* feedURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/notifications", theRecipientFacebookId];
SLRequest* feedRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodPOST URL:feedURL parameters:parameters];
feedRequest.account = self.account;
[feedRequest performRequestWithHandler: ... ]
Unfortunately, I keep getting this :
error = {
code = 15;
message = "(#15) This method must be called with an app access_token.";
type = OAuthException;
};
It's really driving me nuts....