指定子页面时 Facebook 重定向缺少查询字符串参数
在我的网站上,我允许用户通过在我的网站上创建帐户或使用他们的 Facebook 帐户进行身份验证。如果他们选择使用我的网站帐户而不是 FB 登录,在我网站的一个页面上,我允许他们使用他们的 FB 帐户中的好友列表搜索好友。因此,当他们选择搜索也在我的网站上拥有帐户的朋友时,我必须在此时对他们进行身份验证,以便我拨打电话以显示 FB 登录页面。我正在使用 Facebook SDK 来执行此操作。到目前为止没有问题...
string[] extendedPermissions = FacebookApp.ExtendedPermissions.Split(',');
FacebookOAuthClient oauth = new FacebookOAuthClient { ClientId = FacebookApp.AppId };
var parameters = new Dictionary<string, object>
{
{ "response_type", responseType },
{ "display", display },
{ "state", state},
{ "redirect_uri", FacebookApp.RedirectUri + redirectUriPage}
};
if (extendedPermissions != null && extendedPermissions.Length > 0)
{
var scope = new StringBuilder();
scope.Append(string.Join(",", extendedPermissions));
parameters["scope"] = scope.ToString();
}
Uri loginUrl = oauth.GetLoginUrl(parameters);
return loginUrl;
在 Facebook 上的应用程序设置中,我已将站点 URL 指定为:[http://www.]suchandsuch.com/Subdir/。 Facebook 声明他们只会重定向到这个 URL。当我拨打电话来验证该人的身份时,我会传入一个redirect_uri参数,如上所示,因为我想重定向到 http://www.suchandsuch.com/Subdir/subpage.aspx。重定向有效,但是当我检查 Response.QueryString 时它是空的,但是当我查看浏览器上的地址栏时,所有参数都在查询字符串上。我假设 FB 将重定向到“应用程序”页面上指定的 url 下方的任何页面。我是否遗漏了某些内容,或者 FB 真的只会重定向到指定的确切网址吗?
PS 忽略网址周围的 [],所以不会让我在问题中发布那么多链接。 :)
On my site I allow users to authenticate via creating an account with my site or using their Facebook account. In the case they choose to log in with my site account rather than FB, on one page within my site I allow them to search for friends using the friend list from their FB account. So at the point they choose to search for friends that also have accounts with my site, I have to authenticate them at that point so I make the call to present the FB login page. I am using the Facebook SDK to do this. No problems to this point...
string[] extendedPermissions = FacebookApp.ExtendedPermissions.Split(',');
FacebookOAuthClient oauth = new FacebookOAuthClient { ClientId = FacebookApp.AppId };
var parameters = new Dictionary<string, object>
{
{ "response_type", responseType },
{ "display", display },
{ "state", state},
{ "redirect_uri", FacebookApp.RedirectUri + redirectUriPage}
};
if (extendedPermissions != null && extendedPermissions.Length > 0)
{
var scope = new StringBuilder();
scope.Append(string.Join(",", extendedPermissions));
parameters["scope"] = scope.ToString();
}
Uri loginUrl = oauth.GetLoginUrl(parameters);
return loginUrl;
In my app settings on Facebook I have specified the Site URL as: [http://www.]suchandsuch.com/Subdir/. Facebook states that they will only redirect to this URL. When I make the call to authenticate the person, I pass in a redirect_uri parameter as seen above because instead of [http://www.]suchandsuch.com/Subdir/ I want to redirect to http://www.suchandsuch.com/Subdir/subpage.aspx. The redirect works but when I check Response.QueryString it is empty however when I look at the address bar on the browser, all the parameters are there on the querystring. I assume that FB will redirect to any page underneath the url specified on the Apps page. Am I missing something or is it true that FB will only redirect to the exact url specified?
PS ignore the [] around the urls, SO wouldn't let me post that many links in my question. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,FB 只会重定向到带有参数的确切 URL。
Apparently, FB will only redirect to that exact URL with the parmeters.