codeandcloud
codeandcloud

Reputation: 55200

Getting AccessToken from Code using Facebook C# SDK

For Facebook C# SDK version 5.0 we where using

FacebookOAuthClient result = new FacebookOAuthClient();
dynamic tokenResult = oAuthClient.ExchangeCodeForAccessToken(code);

I have upgraded my Facebook C# SDK to version 6.0 and now there is no FacebookOAuthClient.
Its just FacebookClient now.

What is the new function that does the OAUth dance of getting access_token from code?

Upvotes: 1

Views: 4701

Answers (1)

prabir
prabir

Reputation: 7794

FacebookOAuthClient was removed in v6. You can find the alternative method at http://csharpsdk.org/docs/faq.html for v6.

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

Upvotes: 1

Related Questions