1
我使用的是Microsoft.AspNet.Mvc.Facebook
NuGet包。我想交换扩展访问令牌(取代offline_access权限的令牌)的常规令牌。扩展Facebook令牌
从周围的Googling我找到的网址应该是这种格式:
https://graph.facebook.com/oauth/access_token?
client_id=[APP_ID]&
client_secret=[APP_SECRET]&
grant_type=fb_exchange_token&
fb_exchange_token=[EXISTING_ACCESS_TOKEN]
所以我用下面的代码:
var longToken = await context.Client.PostTaskAsync("/oauth/access_token",
new
{
client_id = fbApp.AppId,
client_secret = fbApp.AppSecret,
grant_type = "fb_exchange_token",
fb_exchange_token = context.AccessToken
});
这将返回一个空。没有错误或任何东西。只是一个空值。
编辑:也试过以下,这也没有工作。但是GET
似乎比POST
更合乎逻辑。
dynamic result = context.Client.Get("oauth/access_token",
new
{
client_id = fbApp.AppId,
client_secret = fbApp.AppSecret,
grant_type = "fb_exchange_token",
fb_exchange_token = context.AccessToken
});
var longToken = result.access_token as string;
我正在使用'C#SDK'。这就是为什么我用'C#'和'asp.net-mvc'标记这个问题的原因。我没有得到回应。这是问题。 –
而不是使用SDK为什么不定期进行HTTP GET调用并查看是否得到响应? – SalGad