简体   繁体   English

如何使用Facebook C#SDK生成User_token

[英]How to generate User_token using Facebook C# SDK

I'm trying to perform a search for public posts by facebook graph api. 我正在尝试通过facebook graph api搜索公共帖子。

I got the access token by executing this code: 通过执行以下代码,我获得了访问令牌:

        dynamic tokenInfo =
          fb.Get(
            String.Format(
              "/oauth/access_token?client_id={0}&client_secret={1}&grant_type=client_credentials",
              ConsumerKey,
              ConsumerSecret));

        var appAccessToken = (string)tokenInfo.ToString();// tokenInfo.access_token;

And I put this access token in my url like this: 我将这个访问令牌放在我的网址中,如下所示:

https://graph.facebook.com/search?access_token=111111111111111|xxxxxxxxxxxxxx-xxxxxx&type=post&metadata=1&callback=display&q=voyage&since=2013-07-10&limit=500000

But I'm getting the message bellow: 但是我得到的消息如下:

/**/ display({
   "error": {
      "message": "(#15) Requires session when calling from a desktop app",
      "type": "OAuthException",
      "code": 15
   }
});

I have been trying to find the answer to the same question, From what i learned, 我一直在努力寻找相同问题的答案,从我学到的知识,

We need to get User_token and use it as, 我们需要获取User_token并将其用作,

https://graph.facebook.com/search?access_token={User_token}&type=post&metadata=1&callback=display&q=voyage

You can get an User_token at https://developers.facebook.com/tools/access_token/ 您可以通过https://developers.facebook.com/tools/access_token/获得User_token。

Then it is indeed working. 然后确实可以正常工作。 But the question is how do we generate User_token? 但是问题是我们如何生成User_token?

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

相关问题 如何使用Facebook C#SDK获取用户朋友列表? - How To Get User Friends List Using Facebook C# SDK? 如何使用Facebook C#SDK将故事发布到当前已登录用户的Facebook墙上? - How can I post stories to current logged in user's Facebook wall using Facebook C# SDK? 使用Facebook C#SDK-如何发布到具有访问令牌的墙上 - Using Facebook C# SDK - how to post to the wall having the access token 如何从 facebook 获取用户的朋友,并使用 C# Facebook ZF203675AZ5E5043F8AB66 向他们发送所有消息 - How to get user's friends, from facebook, and send them all messages, by using C# Facebook SDK? Facebook C#SDK和访问令牌 - Facebook C# SDK and Access Token C#Facebook SDK访问令牌处理 - C# Facebook SDK Access Token Handling 如何在用户离线时发布到用户的墙上,通过我的应用更新他的令牌(如果已过期)。 C#Facebook SDK - How to post to a user's wall while he is offline,renew his token(if expired) via my app. C# Facebook SDK 如何使用Facebook C#SDK在Facebook上更新笔记 - How to update note on Facebook using Facebook C# SDK 使用Facebook C#SDK获取C#WebForms访问令牌时出错 - Error getting an access token for c# webforms using facebook c# sdk 如何使用C#Facebook SDK 6.0.10.0在用户墙上发布 - How to publish on user's wall with C# Facebook SDK 6.0.10.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM