Facebook's mobile open graph - iphone

I've recently heard that you don't have to create webpages for opengraph objects anymore and just post them from iOS app directly.
Having said that i've configured my Facebook app to be enabled for iOS only, but when i try posting OG object like that i get error:
NSMutableDictionary<FBOpenGraphObject> *object =
[FBGraphObject openGraphObjectForPostWithType:#"designdailyapp:item"
title:[NSString stringWithFormat:#"%# by %#", [currentObject objectForKey:#"Title"], [currentObject objectForKey:#"Designer"]]
image:#"https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png"
url:#"http://designdaily.me/site.html?id=111"
description:[currentObject objectForKey:#"Description"]];
[FBRequestConnection startForPostOpenGraphObject:object completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSString* resultID = [result objectForKey:#"id"];
//THIS IS WHERE I GET THE ERROR
if (!error) {
}
}];
This is the error i'm getting.
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xc0a3ae0 {com.facebook.sdk:HTTPStatusCode=400, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 100;
message = "(#100) Object Base Domain Not Allowed: Object at URL 'http://designdaily.me/site.html?id=111' of type 'designdailyapp:item' is invalid because the domain 'designdaily.me' is not allowed for the specified application id '477605465664930'. You can verify your configured 'App Domain' at https://developers.facebook.com/apps/477605465664930.";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:ErrorSessionKey=, expirationDate: 2013-12-08 15:28:35 +0000, refreshDate: 2013-10-09 15:28:35 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
"user_friends",
installed,
"basic_info",
email,
"publish_actions"
)>}
I can get around it by configuring my Facebook app to also enable 'Website with Facebook login' and filling in domain field, but then i get rejected by not having a web site with Facebook login.
Anyone got mobile open graph to work?
thanks in advance!

Related

Error while getting Contacts from Microsoft graph api

I am trying to fetch a user's Contacts using the Microsoft Graph SDK. I am able to get the user details using graphClient.me(), but when I try to get a list of contacts I am getting an error:
Graph SDK ERROR :
Error from data task :
Error Domain=com.microsoft.graph.errors
Code=400 "bad request"
UserInfo={
NSLocalizedDescription=bad request,
error= AuthenticationError : Error authenticating with resource
}
Graph SDK ERROR : Caused by request <NSMutableURLRequest: 0x1738bc70> {
URL: https://graph.microsoft.com/v1.0/me/contacts
}
My Code:
self.graphClient.me().contacts().request().getWithCompletion {
(_ contacts: MSCollection?,
_ nextRequest: MSGraphUserContactsCollectionRequest?,
_ error: Error?) in
if error == nil {
print("contacts \(contacts)")
}
else {
print("error \(error?.localizedDescription)")
}
}
My Scopes:
let SCOPES = ["openid", "profile","User.Read","Contacts.Read"]
The /contacts endpoint requires that the user has an accessible Exchange Mailbox. If the user doesn't have a mailbox provisioned in Exchange Online for this tenant, several endpoints that rely on Exchange will fail (/contacts, /events, /messages, etc.).

could not checkin on facebook from my iOS application

Recently Publishing a Checkin object is deprecated in favor of creating an Open Graph story with a location attached. You can also create a Post with a location attached using the 'publish_steam' extended permission.
I have posted checkin from my application by posting a story on timeline with the place id and it was working fine two days ago but now I am getting this error response
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x1e5d03e0 {com.facebook.sdk:HTTPStatusCode=400, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 1;
"error_data" = {
kError = 1455002;
};
message = "(#1) An unknown error occurred";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x1f98cfd0, state: FBSessionStateOpenTokenExtended, loginHandler: 0x1f98d330, appID: 372278036211319, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy:
Do anyone have the fix of this issue?

Upload video to Facebook from the server

I have a problem when uploading videos to Facebook.
I use Facebook SDK for Android: https://github.com/facebook/facebook-android-sdk to get the access token with the following permissions: "publish_stream","email","video_upload","publish_actions"
Then I send token to the server, which should upload the video. The server tries to upload video using following code:
string fullurl = string.Format("https://graph-video.facebook.com/me/videos?title={0}&description={1}&access_token={2}", HttpUtility.UrlEncode(fileName), HttpUtility.UrlEncode(description), token);
Facebook returns an error:
System.Net.WebException: The remote server returned an error: (400) Bad Request.
at System.Net.WebClient.UploadFile(Uri address, String method, String fileName)
at System.Net.WebClient.UploadFile(String address, String fileName)
But, when I check token with the following link: https://graph.facebook.com/me?access_token=myToken Facebook returns user info. That means that token is valid. But, if this request returns error code, where I can find information about error codes?
This solution works perfectly for some users, for other users it works unstable ( 4 of 6 videos uploading failed. Facebook returns that: "connection closed by remote server"). And have not worked for some users with error: "The remote server returned an error: (400) Bad Request".
What is wrong in my code?
I've solve the problem. I have start using facebook SDK for .NET http://facebooksdk.net/ and it works for me.
Facebook.FacebookClient fb = new FacebookClient(facebookEditTask.facebookToken);
fb.PostCompleted += (o, e) =>
{
if (e.Cancelled || e.Error != null)
{
return;
}
var result = e.GetResultData();
facebookVideoUrl = CreateLinkToVideo(result.ToString());
};
dynamic parameters = new ExpandoObject();
parameters.source = new FacebookMediaStream
{
ContentType = "video/mp4",
FileName = Path.GetFileName(facebookEditTask.FilePath)
}.SetValue(File.OpenRead(facebookEditTask.FilePath));
parameters.message = fbMessage;
Task t = fb.PostTaskAsync("me/videos",
new { message = fbMessage, parameters.source });

getting OAUthException on FacebookMobile.login

i'm trying to login to facebook in order to share a link through facebook sharer
http://www.facebook.com/share.php?u=
i'm init the FacebookMobile on application start with no access token and than tries the below:
var facebookWebView:StageWebView = new StageWebView();
facebookWebView.viewPort = new Rectangle (0,0, stage.width, stage.height-100);
var permissions:Array = ["publish_stream"];
FacebookMobile.login(onfacebookLogin, this.stage, permissions, facebookWebView);
the login fails and show an execption on the flash builder 4.5 emulator:
{
"error": {
"message": "Error validating application.",
"type": "OAuthException"
}
}
anyone encountered it once?
Seems like your application missing some configuration.
Check the facebook app page properties.

Facebook Exception #100 : Does not resolve to a valid user ID

While trying to post to a user's facebook wall using PHP, I am getting the error
{
"error": {
"type": "OAuthException",
"message":"(#100) http:\/\/spats.in\/nssc2 does not resolve to a valid user ID"
}
}
This is my code :
$apprequest_url = "https://graph.facebook.com/feed";
$mymessage="Hello World!";
$parameters = "?" . $access_token . "&message=" . urlencode($mymessage) . &id=".urlencode('http://spats.in/nssc2')."&method=post";
$myurl = $apprequest_url . $parameters;
$result = file_get_contents($myurl);
What is the problem?
One reason for getting the (#100) <url> does not resolve to a valid user ID error is that the page has its Open Graph meta tags set incorrectly. You can use Facebook's Open Graph Debugger to see what might be wrong.
I figured it out myself. The request URL should have been http://graph.facebook.com/me/feeds/ and no id parameter was required.