无法使用 Facebook API 发布

本文关键字:API 发布 Facebook | 更新日期: 2023-09-27 17:56:59

>我正在使用检索访问令牌

 if (window.location.hash.length == 0) {
            url = "https://www.facebook.com/dialog/oauth?client_id=" +
                     appId + "&redirect_uri=" + window.location +
                     "&response_type=token&scope=email,read_stream,publish_stream";
                       window.location.href(url);
        } else {
            accessToken = window.location.hash.substring(1);
}

并使用以下方法发布源

 FacebookClient client = new FacebookClient(strAccessToken);
                Dictionary<string, object> postMessage = new Dictionary<string, object>();
                postMessage["message"] = "test post from facebook app";
                postMessage["link"] ="http://google.com";
                postMessage["name"] = "";
                postMessage["caption"] = "";
                postMessage["description"] = "test post from facebook app";
                object result = client.Post("me/feed", postMessage);

我收到错误"无法连接到远程服务器"

这里可能有什么问题?

无法使用 Facebook API 发布

您将令牌存储在"accessToken"中,但传递"strAccessToken"? 有这么简单吗?