Windows Phone 8 Facebook认证 [英] Windows Phone 8 Facebook Authentication

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

问题描述

我正在为Windows Phone 8的应用程序工作,我想给用户使用他们的Facebook帐户登录的可能性,因此他们不必在我的应用程序上创建一个帐户。



我看到了Facebook SDK for .NET,并决定使用它,因为它似乎是真正有效和受欢迎的。



As一个初学者,我遵循了SDK中的教程: http://facebooksdk.net/docs/电话/教程/



我在教程中做了同样的事情,一切都没问题,因为我登录。我点击登录按钮,我被重定向到教程中的FacebookLoginPage(具有空格的.xaml,以便webbrowser可以放在其中),然后出现带有Facebook页面的web浏览器键入我的登录名和密码。之后,我被重定向到要求在我的Facebook帐户权限的页面,我点击确定。一切都很好,到目前为止。



然后来我的问题。我应该在教程中重定向到他们所说的LandingPage,但是我不是被重定向到login_success( https://www.facebook.com/connect/login_success.html ),其中显示成功和安全警告,然后再没有任何反应...

我认为我的代码中的东西不正确,所以我花了几个小时的时间在工作,没有找到任何东西。所以我试图运行他们在网站的文档中提供的示例应用程序,我刚刚修改了Facebook AppID(我已经把我的),同样的事情发生了。
我也尝试过在诺基亚开发者Wiki上找到的其他东西,同样的事情。



所以我认为我的Facebook应用程序有问题,但我可以没有找到它是什么...
有人可以给我一些帮助吗?我在这里死亡:(



我的英语错误提前道歉,祝你一个美好的一天!



更新:我终于在本教程中执行了 http:/ /developer.nokia.com/Community/Wiki/Integrate_Facebook_to_Your_Windows_Phone_Application

解决方案

重定向到 https://www.facebook.com/connect/login_success.html 应该包含accessToken作为网址参数,所以如果你允许导航到这个URL,它确实是一个安全风险,因为它暴露了AccessToken。你需要从WebBrowser控件侦听导航事件,如果浏览器导航到 https://www.facebook.com/connect/l ogin_success.html ,那么您需要取消导航,并从url参数获取AccessToken。



更新:
它看起来像FB将其OAuth登录响应从... login_success.html#access_token =更改为... login_success.html?#access_token =#字符前面有一个?字符。


I am working on an application for Windows Phone 8 and I'd like to give the possibility to the users to login with their Facebook account, so they won't have to create an account on my application.

I saw the Facebook SDK for .NET and decided to use it because it seems to be really efficient and popular.

As a beginner, I followed the tutorial in the doc of the SDK : http://facebooksdk.net/docs/phone/tutorial/

I did the exact same thing that in the tutorial, everything is okay since I login. I click on the login button, I'm redirected to what they call the "FacebookLoginPage" in the tutorial (a .xaml with an empty grid so the webbrowser can fit in it), then appears the webbrowser with the Facebook page where I can type my login and password. After that, I'm redirected to the page that asks for permissions on my Facebook account, I click on OK. Everything is good so far.

And then comes my problem. I should be redirected to what they call the "LandingPage" in the tutorial, but instead of that I'm redirected to the facebook "login_success" (https://www.facebook.com/connect/login_success.html‎) which displays "Success" and also a security warning, and then nothing happens anymore...

I thought something in my code was not right so I spend a couple of hours working on it, didn't find anything. So I tried to run the sample application that they provide in the doc of the website, I just modified the Facebook AppID in it (I've put mine), and same thing happened. I also tried other things that I found on the Nokia Developer Wiki, same thing.

So I think something is wrong with my Facebook Application, but I can't find what it is... Is anybody could give me some help ? I'm dying here :(

I apologize in advance for my english mistakes, and I wish you a good day !

UPDATE : I finally did it following this tutorial http://developer.nokia.com/Community/Wiki/Integrate_Facebook_to_Your_Windows_Phone_Application

解决方案

The redirect to "https://www.facebook.com/connect/login_success.html‎" should contain the accessToken as a url parameter, so if you allow navigating to this url it is indeed a security risk as it exposes the AccessToken. You need to listen for the 'Navigating' event from the WebBrowser control and if the browser is navigating to "https://www.facebook.com/connect/login_success.html‎" then you need to cancel the navigation and get the AccessToken from the url parameter.

UPDATE: It looks like FB changed their OAuth login response from ...login_success.html#access_token= to ...login_success.html?#access_token= There is now a "?" character before the "#" character.

这篇关于Windows Phone 8 Facebook认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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