无法使用facebook api发布

时间:2011-05-20 14:42:11

标签: c# facebook

我正在使用

检索访问令牌
 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);

我发现错误'无法连接到远程服务器'

这里有什么不对?

1 个答案:

答案 0 :(得分:1)

您将令牌存储在'accessToken'中但是传递'strAccessToken'?可能就这么简单吗?