Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 我使用facebook访问令牌在我自己的页面上发布帖子,但现在我得到一个例外,我的访问令牌过期了为什么?_C#_Facebook_Winforms - Fatal编程技术网

C# 我使用facebook访问令牌在我自己的页面上发布帖子,但现在我得到一个例外,我的访问令牌过期了为什么?

C# 我使用facebook访问令牌在我自己的页面上发布帖子,但现在我得到一个例外,我的访问令牌过期了为什么?,c#,facebook,winforms,C#,Facebook,Winforms,有没有办法永远获得访问令牌?所以它不再过期了?有所谓的短期访问令牌,在两小时后过期,还有所谓的长期访问令牌,在60天后过期。没有办法收到过期的 很明显,你使用的是短期访问令牌 因此,这里和这里的文档可以看到如何将短寿命转换为长寿命 private string PostFacebookWall(string accessToken, string message) { var responsePost = ""; try { //create the fa

有没有办法永远获得访问令牌?所以它不再过期了?

有所谓的短期访问令牌,在两小时后过期,还有所谓的长期访问令牌,在60天后过期。没有办法收到过期的

很明显,你使用的是短期访问令牌

因此,这里和这里的文档可以看到如何将短寿命转换为长寿命

private string PostFacebookWall(string accessToken, string message)
{
    var responsePost = "";
    try
    {
        //create the facebook account object
        var objFacebookClient = new FacebookClient(accessToken);
        var parameters = new Dictionary<string, object>();
        parameters["message"] = message;
        responsePost = objFacebookClient.Post("feed", parameters).ToString();
    }
    catch (Exception ex)
    {
        responsePost = "Facebook Posting Error Message: " + ex.Message;
    }
    return responsePost;
}
(OAuthException - #190) Error validating access token: Session has expired on 12 פברואר 2014 09:00. The current time is 12 פברואר 2014 14:27.

Facebook.FacebookOAuthException was caught
  HResult=-2146233088
  Message=(OAuthException - #190) Error validating access token: Session has expired on 12 פברואר 2014 09:00. The current time is 12 פברואר 2014 14:27.
  Source=Facebook
  ErrorCode=190
  ErrorSubcode=463
  ErrorType=OAuthException
  StackTrace:
       at Facebook.FacebookClient.ProcessResponse(HttpHelper httpHelper, String responseString, Type resultType, Boolean containsEtag, IList`1 batchEtags)
       at Facebook.FacebookClient.Api(HttpMethod httpMethod, String path, Object parameters, Type resultType)
       at Facebook.FacebookClient.Post(String path, Object parameters)
       at ScrollLabelTest.Form1.PostFacebookWall(String accessToken, String message) in e:\scrolllabel\ScrollLabel\ScrollLabel\Form1.cs:line 266
  InnerException: