I'm currently trying to simply post on my own wall with a windows phone app written in c#/xaml.
This is my current status:
Where is my problem? How to I correctly store the accessToken to use it the next time the app opens? [Or how do I manage the users session in a better way?]
few pieces of code I use:
private void Test_Click(object sender, RoutedEventArgs e)
{
string acccessToken = App.AccessToken;
FacebookClient appp = new FacebookClient(acccessToken);
System.Diagnostics.Debug.WriteLine(acccessToken);
try
{
appp.PostTaskAsync("me/feed", new { message = "hi" });
}
catch (FacebookOAuthException)
{
}
}
-
private async Task Authenticate()
{
string message = String.Empty;
try
{
session = await App.FacebookSessionClient.LoginAsync("user_about_me,read_stream,publish_actions");
App.AccessToken = session.AccessToken;
App.FacebookId = session.FacebookId;
App.isAuthenticated = true;
}
catch (InvalidOperationException e)
{
}
}
Okay, silly thing I was not aware of...
Facebook seems to not accepting the same Post twice in a short period of time (spam protection I guess). After I tried it again after five minutes or so, it was working like expected!
The only thing I quite don't get is why an OAuthException is being thrown...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.