[我的卑微的请求:请不要忽略这个问题,只需添加一些参考问题链接。我阅读所有的参考我可以,但我没有得到我所需要的]C#facebook应用程序
我想做一个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)无效的验证码格式” 我搜索计算器中许多环节和http://developers.facebook.com/docs/authentication/还,但它并没有帮助我找到解决方案。我甚至不知道使用哪个uri。 我使用Visual Studio 2010 [请DONOT只是简单地被标记为重复忽视这个问题] 温柔给我请..
@Shingestu,_appKey2和_secret2只因为当我跑在调试模式下申请我finalRedirectUri得到的值正确格式当我复制到浏览器地址栏时,它重定向到应用程序批准的屏幕。谢谢Shingestu,我希望我的观点很清楚。 – 2012-03-04 15:16:47
难道FacebookApplication.Current不是oAuthClient的有效constructr参数吗? – 2012-03-04 15:31:26
我试图删除,也没有改变。 – 2012-03-04 15:43:07