【发布时间】:2012-03-04 14:57:35
【问题描述】:
[我的谦虚要求:请不要仅仅通过添加一些参考问题链接来忽略这个问题。我阅读了所有我能读到的参考资料,但我没有得到我需要的]
我正在尝试制作一个需要离线访问用户详细信息的 Windows/控制台应用程序。所以我尝试了以下代码。
String finalRedirectUri = "https://www.facebook.com/dialog/oauth?client_id=" +
_appKey2 + "&redirect_uri=" + _SiteURL + "&scope=email,read_stream";
String GraphUri = "https://graph.facebook.com/oauth/access_token?client_id=" +
_appKey2 + "&redirect_uri=" + _SiteURL + "&scope=email,read_stream";
FacebookClient client = new FacebookClient(_appKey2, _secret2);
FacebookOAuthClient oAuthClient =
new FacebookOAuthClient(FacebookApplication.Current);
oAuthClient.AppId = _appKey2;
oAuthClient.AppSecret = _secret2;
oAuthClient.RedirectUri = new Uri(finalRedirectUri);
String Uri = oAuthClient.GetLoginUrl().ToString();
try
{
dynamic tokenResult =
oAuthClient.ExchangeCodeForAccessToken("offline_access");
}
catch (Exception exp)
{
MessageBox.Show("" + exp.Message);
}
我总是收到错误消息:“(OAuthException) 验证码格式无效” 我在 stackoverflow 和 http://developers.facebook.com/docs/authentication/ 中搜索了许多链接,但它并没有帮助我找到解决方案。我什至不知道使用哪个 uri。 我正在使用 Visual Studio 2010 [请不要仅仅通过标记为重复来忽略这个问题] 请对我温柔一点..
【问题讨论】: