I would like to write a console application that automatically sends information to my wall every morning.
I registered for facebook developer and have AppID and App Secret
I tried to play from the SDK in C # and looked through a few examples.
It seems like the examples get the user token, but they have to use the browser that is in the windows. This is an automatic process - therefore, I do not want the user to be present.
Ive also created some examples using an application token, but it seems like it cannot write to the wall.
I wrote the Twitter equivalent very quickly. Am I missing something here ???
What is the correct way?
It seems that all I need is: FaceBookClient (appID, appSecret) and then just FaceBookClient.Put (message) ???
clarification added:
Playback using winform application for s # cdk I needed to change their FacebookLoginDialog.cs to use the following URL:
https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=APPID&client_secret=APPSECRET&scope=user_about_me,publish_stream,offline_access
which returns a passkey in a WebBrowser.DocumentText
If I call then:
var fb = new FacebookClient(_accessToken); dynamic parameters = new ExpandoObject(); parameters.message = "Hello World!"; dynamic result = fb.Post("me/feed", parameters);
I get an exception:
(OAuthException) An active access token should be used to request information about the current user.
If I changed the code above to NOT use this access token, but use appID and Appsecret:
FacebookClient myFacebookClient = new FacebookClient("APPID", "APPSECRET"); dynamic parameters = new ExpandoObject(); parameters.message = "Hello World!"; dynamic result = myFacebookClient.Post("me/feed", parameters);
Then I get an exception:
(OAuthException) An active access token should be used to request information about the current user.
I think this is the same exception.