Facebook c# sdk 从Facebook SDK v5.4迁移到alpha v6时出现问题
我在登录后使用了下面的代码,它在5.4.1上运行,但是现在它没有按预期工作Facebook c# sdk 从Facebook SDK v5.4迁移到alpha v6时出现问题,facebook-c#-sdk,Facebook C# Sdk,我在登录后使用了下面的代码,它在5.4.1上运行,但是现在它没有按预期工作 FacebookOAuthResult pResult; if (m_pClient.TryParseOAuthCallbackUrl(e.Uri, out pResult)) { if (pResult.IsSuccess) { //handle if success } else { //handle if failed } } 我将FacebookOAuthClient迁移到F
FacebookOAuthResult pResult;
if (m_pClient.TryParseOAuthCallbackUrl(e.Uri, out pResult))
{
if (pResult.IsSuccess)
{
//handle if success
}
else
{
//handle if failed
}
}
我将FacebookOAuthClient迁移到FacebookClient,迁移完所有内容后,这一切都不起作用
我的登录代码如下。我试过旧方法和新方法,但都不管用。注释部分是我为5.4工作的遗留代码。你能帮我看看我做错了什么吗
//Dictionary<string, object> pParameters = new Dictionary<string, object>
//{
// {"response_type", "token"},
// {"display", "touch"},
//};
//if ((extendedPermissions != null) && (extendedPermissions.Length > 0))
//{
// StringBuilder pScope = new StringBuilder();
// pScope.Append(string.Join(",", extendedPermissions));
// pParameters["scope"] = pScope.ToString();
//}
我建议您查看以下位置的winforms示例:
我已经将代码回滚到版本5.4,因为所有内容都正常工作,正如该版本中所预期的那样。我会一直等到v6离开alpha。
Uri pLoginUrl = m_pClient.GetLoginUrl(new { response_type = "token", display = "touch", scope = "publish_stream, offline_access", next = "https://www.facebook.com/connect/login_success.html" }); //also tried redirect_uri=""
m_pBrowser.Visibility = System.Windows.Visibility.Visible;
m_pBrowser.Navigate(pLoginUrl);
private Uri GenerateLoginUrl(string appId, string extendedPermissions)
{
dynamic parameters = new ExpandoObject();
parameters.client_id = appId;
parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html";
// The requested response: an access token (token), an authorization code (code), or both (code token).
parameters.response_type = "token";
// list of additional display modes can be found at http://developers.facebook.com/docs/reference/dialogs/#display
parameters.display = "popup";
// add the 'scope' parameter only if we have extendedPermissions.
if (!string.IsNullOrWhiteSpace(extendedPermissions))
parameters.scope = extendedPermissions;
var fb = new FacebookClient();
// when the Form is loaded navigate to the login url.
return fb.GetLoginUrl(parameters);
}