简体   繁体   English

Facebook SDK .NET C#错误消息

[英]Facebook sdk .net c# error message

I'm trying to connect to facebook using the Facebook SDK in c# to get user details. 我正在尝试使用c#中的Facebook SDK连接到facebook,以获取用户详细信息。

FacebookClient client = new FacebookClient();
client.AppId = appId;
dynamic me = client.Get("me");

The error message I am receiving in line 3 is: 我在第3行中收到的错误消息是:

A first chance exception of type 'Facebook.FacebookOAuthException' occurred in Facebook.dll 类型“ Facebook.FacebookOAuthException”的第一次机会异常发生在Facebook.dll中

Does anyone know what I did wrong please? 有人知道我做错了吗?

You need to initialise the client with an access token (from the .net sdk): 您需要使用访问令牌(来自.net sdk)初始化客户端:

var fb = new FacebookClient("access_token");

There are various different types of access token, have a look at the facebook dev page for this: 访问令牌有多种不同的类型,请查看facebook开发页面:

https://developers.facebook.com/docs/facebook-login/access-tokens https://developers.facebook.com/docs/facebook-login/access-tokens

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM