汽车的Facebook的OAuth从ASP.NET C# [英] Auto Facebook OAuth from ASP.NET C#
问题描述
我需要OAuth认证帮助到Facebook。我能够做的步骤,所提到并且成功验证Facebook的API,让我的个人资料信息,以及后到我的新闻提要。
I need help on oAuth authentication to facebook. I am able to do the steps that facebook API mentioned and successfully authenticated, get my profile information as well as post to my news feed.
我想我的应用程序自动登录而不是路由到Facebook的登录页面上代表用户(即获得数据库凭据和做汽车的OAuth)。这样用户可以键入应用程序的消息,然后点击按钮应提交一份投递到Facebook页面。
I want my application to login automatically rather than routing to Facebook login page on behalf of a user(i.e. get credentials from db and do auto oauth) . So that the user can type a message on application and click on button should submit a post to facebook page.
感谢
推荐答案
你需要得到的是一个访问令牌。这是一个关键,它允许你继续访问该帐户,直到你的令牌过期或者用户取消它。
What you need to get is an access token. This is a key which allows you continued access to the account until your the token expires or the user cancels it.
当你第一次验证,如果你设置你所需的权限。让您可以存储和使用,initiale的调用中的authToken
When you first authenticate if you have set the required permissions you get an authtoken which you can store and use to initiale further calls.
var client = new FacebookClient("my_access_token");
dynamic result = client.Get("19292868552_118464504835613");
string id = result.id;
string fromName = result.from.name;
string fromCategory = result.from.category;
string message = result.message;
int likes = result.likes;
foreach (dynamic comment in result.comments.data) {
string commentId = comment.id;
string commentMessage = comment.message;
}
请参阅本文有关过程的详细信息:
see this article for details about the process:
HTTP: //benbiddington.wordpress.com/2010/04/23/facebook-graph-api-getting-access-tokens/
这篇关于汽车的Facebook的OAuth从ASP.NET C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!