Where did FacebookOAuthClient go?

社会主义新天地 提交于 2019-12-09 17:16:07

问题


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?


回答1:


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"
});


来源:https://stackoverflow.com/questions/9836042/where-did-facebookoauthclient-go

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!