开发者

Auto Facebook OAuth from ASP.NET C#

开发者 https://www.devze.com 2023-03-16 03:25 出处:网络
开发者_Go百科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 new
开发者_Go百科

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.

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.

Thanks


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.

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消