Facebook的C#SDK和访问令牌 [英] Facebook C# SDK and Access Token

查看:174
本文介绍了Facebook的C#SDK和访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够在使用Facebook C#SDK我自己的Web应用程序对自己的(我的个人资料,不只是我的应用程序)验证。使用图形API,我可以得到一个访问令牌,但该令牌似乎并不与Facebook的C#正常工作,因为它似乎是无状态的。

I'd like to be able to authenticate myself (my profile, not just my app) on my own web application using the Facebook C# SDK. Using the Graph API, I can get an access token, but that token does not seem to work properly with the Facebook C# as it seems to be stateless.

的错误被抛出的是:

(OAuthException) An active access token must be used to query information about the current user.



我已经捅了Facebook的C#SDK和文档各地最我看到的信息是将用户重定向到这是不是我要找的登录页面。

I've poked around the Facebook C# SDK and documentation and most of the info I'm seeing is to redirect users to a login page which is not what I'm looking for.

有没有人有自动记录的一个很好的样本中自己,所以我可以拉了我自己的信息?

Does anyone have a good sample of auto-logging in myself so I can pull up my own information?

TIA

推荐答案

当你说自己 ?你的意思是应用或实际的Facebook用户

When you say "yourself" do you mean the app or your actual facebook user?

如果它只是你的应用程序,你可以张贴到这个URL获得访问令牌:

If it's just your app, you can get an access token by POSTing to this URL:

https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=APP_ID_HERE&client_secret=APP_SECRET_HERE

您可以使用此访问令牌来执行代表用户的行为,如果他们认可你的应用程序这样做。

You can use this access token to perform actions on behalf of your users if they have authorized your app to do so.

这篇关于Facebook的C#SDK和访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆