我最近将 phonegap-facebook-plugin ( https://github.com/phonegap/phonegap-facebook-plugin ) 集成到 iOS 和 Android(相同的应用程序)中。
我想做一些我认为很简单的事情:绕过对 native facebook 的调用以进行登录/身份验证,并且始终使用网络对话框。如何实现这一目标?
我的登录代码目前是这样的:
初始化代码:
//facebook initialization
FB.init({
appId: 'xxxxxxxxxxxx', //'<%#= FB_APP_ID %>',//'',
nativeInterface: CDV.FB,
useCachedDialogs: false
});
登录调用是:
FB.login(function(response) {
if (response.authResponse) {
// connected
me.signInFacebook({
token: response.authResponse.accessToken,
email: response.authResponse.email,
success: function (data) {
// hide login view and show tabview
form.destroy();
// continue whatever action was previously happening
me.continueAction(tabIndexBack, callback);
},
failure: function (response) {
// show errors Ext.Viewport.down('tabscontainerview').setActiveItem(3);
}
});
} else {
//go back
Ext.Viewport.down('tabscontainerview').setActiveItem(3);
alert('fb login error');
}
},{ scope: "email" });
感谢您的帮助!
最佳答案
我创建了一个插件来促进 Facebook 和 phonegap 之间的连接,而无需仅将 Plugin Native 与 Jquery 一起使用:
关于使用 PhoneGap/Cordova App 登录 Facebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15936682/