WP8 - Facebook登录问题 [英] WP8 - Facebook Login Issue

查看:174
本文介绍了WP8 - Facebook登录问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows Phone 8上的Facebook C#SDK来验证Facebook上的用户。为此,我在以下代码中执行以下代码:。 ..,它显示了FB登录页面的移动版本。



以前没有问题,但是最近FB执行重定向时,它也会剥离参数显示=页面。那么会发生什么,当一个成功的FB登录时,打开没有这个参数的login_success.html页面。没有传入display = page参数,它默认为display = touch。不幸的是,这个URL不会在URL中附加令牌字符串,因此会显示第一个线程中显示的页面。



解决方案是,而不是使用以下代码生成登录URL,将其修改为



原始:

  Browser.Navigate(_fb.GetLoginUrl(参数)); 

ammended:

 code> var URI = _fb.GetLoginUrl(parameters).toString()。replace(www.facebook.com,m.facebook.com); 
Browser.Navigate(new Uri(URI));


I am trying to authenticate a user on Facebook using the Facebook C# SDK on Windows Phone 8. To do so I am following the code here: FacebookLoginPage.xaml.cs

But the problem I am facing is that, whenever I input my username and password into the dialog that opens to authenticate the user, I just get the following page:

After this, my program does not redirect to the Landing page which is a separate view. The other solutions I have seen that suggest hiding the WebView are not applicable since the authentication is abstracted into a single LoginAsync function call. Any suggestions on what to do?

解决方案

It would seem that FB has made some changes to its redirection script, when it detects a Windows Phone webbrowser control.

What the C# SDK does, is generate the login page as "http://www.facebook.com....". When you open this URL on the webbrowser control, it gets redirected to "http://m.facebook.com..." which displays the mobile version of the FB login page.

This previously has no issue, but recently, when FB does the redirection, it also strips the parameter "display=page" from the URL. What happens then is that when a successful FB login is made, the "login_success.html" page is opened without this parameter. Without the "display=page" parameter passed in, it defaults to "display=touch". This URL unfortunately, does not append the token string in the URL, hence the page shown in the very first thread is displayed.

The solution to this is, instead of using the below code to generate the login URL, ammend it to

original:

Browser.Navigate(_fb.GetLoginUrl(parameters));

ammended:

var URI = _fb.GetLoginUrl(parameters).toString().replace("www.facebook.com","m.facebook.com");
Browser.Navigate(new Uri(URI));

这篇关于WP8 - Facebook登录问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆