简体   繁体   English

使用Facebook C#SDK从代码获取AccessToken

[英]Getting AccessToken from Code using Facebook C# SDK

For Facebook C# SDK version 5.0 we where using 对于Facebook C#SDK 5.0版,我们在哪里使用

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 . 我已经将我的Facebook C#SDK升级到了6.0版,现在没有FacebookOAuthClient
Its just FacebookClient now. 现在只是FacebookClient

What is the new function that does the OAUth dance of getting access_token from code ? OAUth从code获取access_token的新功能是什么?

FacebookOAuthClient was removed in v6. FacebookOAuthClient已在v6中删除。 You can find the alternative method at http://csharpsdk.org/docs/faq.html for v6. 您可以在http://csharpsdk.org/docs/faq.html上找到适用于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"      
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM