试图用openFB与科尔多瓦科尔、试图用、多瓦、openFB

2023-09-07 01:33:50 作者:最不可信的是爱情

所以i'm有一种情况,有人也许能提供帮助。

So i´m having a situation that someone might be able to help.

林创建使用的PhoneGap构建移动应用程序。我正尝试使用此 http://coenraets.org /博客/ 2014/04 / Facebook的PhoneGap的-科尔多瓦且不插件/

Im creating a Mobile APP using PhoneGap Build. I´m trying to use this http://coenraets.org/blog/2014/04/facebook-phonegap-cordova-without-plugin/

右键知道,如果我打开应用程序inBrowser它会奏效。问权限等的正确获取用户数据。当然,我定义了一个有效的OAuth:本地主机/ ... HTML。

Right know if I open the app inBrowser it will work. Ask's for permissions etc and fetch the user data correctly. Of course I defined a Valid oAuth: localhost/...html.

所以它适用于浏览器,但对于移动不工作。 WICH是应该的,如果是这样,对于移动有效的网址是什么?因为,因为它是一个混淆APPiºm。我不认为这是必要的表演code,但如果只是这样问我。

So it works for browser but doesnt work for mobile. Wich should be, if so, the valid url for the mobile? Cause since it's an APP iºm confused. I dont think it's necessary show code but if so just ask me.

感谢;)

推荐答案

我知道了工作的电话。

奇怪的是,一个真正的网址是没有必要的,只是一个语义有效的。我添加了一个Facebook的帆布平台,Facebook的应用程序页面上,并填补了平台形式:

The weird thing is that a real URL is not necessary, just a semantic valid one. I've added a Facebook Canvas platform, on the facebook app page, and filled the platform form:

URL = http://localhost/www/
Secure Canvas URL = https://localhost/www/

两种以上结构域不存在。我还没有填补了有效的OAuth重定向的URI中的高级选项卡字段。

Both of above domains doesn't exists. I haven't filled the "Valid OAuth redirect URIs" field in the advanced tab.

在这之后,我写了下面的code在我的应用程序:

After that, I've written the following code in my app:

openFB.init("xyz!@#123456789"
  , "http://localhost/www/oauthcallback.html");

看来,重要的是,Facebook的帆布的域或子域匹配的openFB.init的redirectUrl参数...

It seems that what matters is that Facebook Canvas's domains or sub domains matches the one on the openFB.init redirectURL param...

我使用openFB 0.1版。我要测试的早期版本。

I'm using openFB version 0.1. I'm gonna test the earlier versions.

更新

这只是已 PhoneGap的服务工作,因为我是用它使openFB明白,我的应用程序是一个网站,因为PhoneGap的开发者的应用程序是一个浏览器的包装,而不是一个应用程序包装。如果我尝试在编译应用程序运行它( PhoneGap的地方共建),我的code不起作用。我想我将不得不使用Facebook的连接比我早想到...

It just have worked because I was using phonegap serve and it makes openFB understand that my app is a website, because phonegap developer app is a browser wrapper, not a app wrapper. If I try to run it in a compiled app (phonegap local build), my code doesn't work. I think I'll have to use facebook-connect earlier than I thought...