尝试使用openFB与科尔多瓦 [英] Trying to use openFB with Cordova

查看:107
本文介绍了尝试使用openFB与科尔多瓦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个情况可能有人可以帮助。

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

我使用PhoneGap Build创建一个移动APP。我试图使用这个 http:// coenraets。 org / blog / 2014/04 / facebook-phonegap-cordova-without-plugin /

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/

知道如果我在浏览器中打开应用程序,它将会工作。询问权限等,并正确获取用户数据。当然我定义了一个有效的oAuth:localhost / ... 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.

所以它适用于浏览器,但不适用于移动设备。那应该是,如果是,移动的有效的url?因为它是一个APP我感到困惑。我不认为这是必要的显示代码,但如果是这样就问我。

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.


谢谢;)

推荐答案

我已经通过电话工作了。

I've got it working on the phone.

奇怪的是,真正的URL不是必需的,只是一个语义有效的URL。我在Facebook应用页面上添加了一个Facebook Canvas平台,并填写了平台表单:

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.

之后,我在我的应用程序中编写了以下代码:


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

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

似乎重要的是Facebook Canvas的域或子域与openFB.init上的域匹配redirectURL param ...

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 local build )中运行它,我的代码不起作用。我想我不得不使用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...

这篇关于尝试使用openFB与科尔多瓦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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