openFB Facebook Login Javascript

593 views Asked by At

Im trying to use OpenFB to create a Facebook login for my app that i'm creating using Phonegap. I am getting the security message after logging in on a white screen.

This is my code:

 openFB.init('1573489959575513'); // Defaults to sessionStorage for storing the Facebook token

 //  Uncomment the line below to store the Facebook token in localStorage instead of sessionStorage
 //openFB.init('1573489959575513', 'something here', window.localStorage);

 function login() {
 openFB.login('email',
 function() {
 alert('Facebook login succeeded');
 },
 function() {
 alert('Facebook login failed');
 });
 }

and the error im getting says: SECURITY WARNING: Please treat the URL above as you would your password.

People have said to install the InAppBrowser plugin, which I have added to my config file, but I'm not sure how to call it? If that is the solution.

In my Facebook developer settings I have set the 'Valid OAuth redirect URIs' as https://www.facebook.com/connect/login_success.html.

Any advice would be greatly appreciated as the solutions i've looked at arent helping.

Thanks!

2

There are 2 answers

0
icaro56 On

Like Neeg wrote. You need to add the Inappbrowser to OpenFB to work.

The new way to add this plugin is:

cordova plugin add cordova-plugin-inappbrowser
0
neeg On

You have to install InAppBrowser Plugin (not just add it to the config file)

cordova plugin add org.apache.cordova.inappbrowser