Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where did FacebookOAuthClient go?

I just "upgraded" to 6.1.0 of the c# SDK and found that the FacebookAuthClient has been removed. I checked the commit log on github and there's not much info there.

Does anyone know how you are supposed to authenticate with the latest version of the SDK?

like image 329
James Avatar asked Mar 23 '12 08:03

James


1 Answers

It has been removed.

Starting with v6 you can now use it with normal FacebookClient.Get() method. http://csharpsdk.org/docs/faq.html

How do I get a Facebook Application Access Token?

var fb = new FacebookClient();
dynamic result = fb.Get("oauth/access_token", new { 
    client_id     = "app_id", 
    client_secret = "app_secret", 
    grant_type    = "client_credentials" 
});

How do I exchange code for access token?

var fb = new FacebookClient();
dynamic result = fb.Get("oauth/access_token", new {
    client_id     = "app_id",
    client_secret = "app_secret",
    redirect_uri  = "http://yoururl.com/callback",
    code          = "code"      
});

How do I extend the expiry time of the access token?

var fb = new FacebookClient();
dynamic result = fb.Get("oauth/access_token", new {
    client_id         = "app_id",
    client_secret     = "app_secret",
    grant_type        = "fb_exchange_token",
    fb_exchange_token = "EXISTING_ACCESS_TOKEN"
});
like image 59
prabir Avatar answered Oct 19 '22 10:10

prabir