ionic/cordova openFB Facebook Login not working (SECURITY WARNING) on android device

835 views Asked by At

I'm using the openFB library in an ionic project. My settings are:

ionic version: 1.7.12 cordova-version: 6.0.0 openFB version: (latest commit)

when running the app in my browser, everything works fine.

In my Phone (android 5.0) there is a problem. When starting the app (on deviceready event), I do window.open = cordova.InAppBrowser.open

When I'm trying to login, the FB login page opens, I'm giving credentials, and click login.

The response is on a facebook page (https://www.facebook.com/connect/blank.html#=) saying:

Success SECURITY WARNING: Please treat the URL above as you would your password and do not share it with anyone. See the Facebook Help Centre for more information.

and the FB login window never closes.

It seems that the openFB eventListener 'loginWindow_loadStartHandler' never fired.

Any ideas?

1

There are 1 answers

0
Nektarios Gioldasis On

I finally resolved this issue.

The problem is on the InAppBrowser cordova plugin. InAppBrowser (version 1.2.0 which is available in the cordova registry at the moment of writing) does not fire the 'loadstart' and 'loadstop' event listeners in android platform (i don't know for IOS).
So the opefFB handler which was registered on 'loadstart' was never fired up.

To solve this, install either the cordova-plugin-inappbrowser@~1.1.1 or install the latest version (1.2.1) directly from github (cordova plugin add https://github.com/apache/cordova-plugin-inappbrowser.git --save).