My question is simple. I just want to post a status update from my desktop application. The app contains a textbox and a button... on button click, I would like to set the textbox.text to facebook based on the user access Token. I found 1 tutorial that says all you need to use is:
FacebookService1.ApplicationKey = apiKey
FacebookService1.Secret = appsecret '<-- but secret is not available
Can anyone correct开发者_开发问答/post code that will update a status through a desktop app after I already of the AccessToken from the user "allow"ing my app?
Imports Facebook
Imports Facebook.Winforms
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim apiKey = "XXXXXXXXXXXXXXXXXX"
Dim accessToken = "XXXXXXXXXXXXXXXXXXXXX"
FacebookService1.ApplicationKey = apiKey
FacebookService1.SessionKey = apiKey + accessToken
FacebookService1.ConnectToFacebook()
FacebookService1.Status.Set(TextBox1.Text.Trim())
End Sub
End Class
The app secret for your specific app is available from http://www.facebook.com/developers/apps.php .
App ID 111111111111111111 API Key 2a2a2a2a2a2a2a2a2a2a2a App Secret 3b3b3b3b3b3b3b3b3b3b3b3b3b3b
The session key will change every time you log in. I don't know the specific code in C# but in javascript you get it from FB.getSession(). The most general approach would be to read the cookie.
BTW: There are a few other questions in SO that I just found dealing with the same. For example,
API api = new API();
api.ApplicationKey = Utility.ApiKey();
api.SessionKey = Utility.SessionKey();
api.Secret = Utility.SecretKey();
api.uid = Utility.GetUserID();
which I got from Facebook Connect and ASP.NET
You can read also http://buruonbrails.blogspot.com/2009/08/how-to-deal-with-facebook-api-infamous.html
精彩评论