phonegap 3.3 iOS Facebook Connect redirect_uri must be absolute - iphone

I am developing ios native application using phonegap. This application has barcodescanner and facebook connect features. I am using phonegap version 2.9.0.
The user has to login with facebook credentials when the application is launched. There is a button in the application and it will redirect to browser (safari) for asking facebook login when the button is clicked. Also, this application has facebook post feature.
It was working fine (facebook connect and barcodescanner) with phonegap version 2.9.0.
Now, facebook connect (for login) is not working after I upgrade phonegap version 3.3.0.
It says "redirect_uri must be absolute" after the browser (safari) is launched.
I am using this link. After I upgrade the phonegap version to 3.3.0, I did not change my application logic. I am using following code for facebook initialize and facebook login when the button is clicked.
Facebook init.
FB.init({ appId: "<appid>", nativeInterface: CDV.FB, useCachedDialogs: false });
Facebook login
FB.login(function(response){},{scope:"email"});
I tried changing the appid also, Same response.
I have included JS files for phonegap framework and facebook connect framework and they are loaded when the application is loaded. I am sure about it. There are no errors while building the app.
Please let me know what I am doing wrong.
--Sridhar

redirect_uri errors usually raise if you don't give the same link the one u used while creating FB app on developers page something like below.
Don't use redirect_uri in initializing or methods just add in developers page FB app. That should work.

This link could be helpfull.
but, I can't make it work the auto install
phonegap local plugin add https://github.com/mallzee/phonegap-facebook-plugin.git --variable APP_ID="[FB APP ID]" --variable APP_NAME="[FB APP NAME]"
it said to my: [error] Variable(s) missing: APP_ID, APP_NAME

This fixed it for me. Apparently cordova failed to copy the APP_ID and APP_NAME variables from the plugin config into the .plist so I had to go in and edit the .plist file that cordova build generates with the value of the variables.
Under platform/ios/<appname>/<appname>-Info.plist search for $APP_ID and $APP_NAME in that file, and replace them with their values.
After doing that the login worked normally.

Related

How to integrate the Facebook login in progressive web application

I am building a Progressive web application with IONIC 3. I am following -
https://medium.com/#fraxool/add-facebook-login-to-your-ionic-3-app-the-step-by-step-guide-88879e391a3b
Now the problem is when I am using ionic serve then in the browser when I am clicking on Login with Facebook button,
then it is showing me an error on the console as
Native: tried calling Facebook.login, but Cordova is
not available. Make sure to include cordova.js or run in a
device/simulator cordovaWarn # vendor.js:60197 main.js:1058 Error
logging into Facebook cordova_not_available
I can understand that as I am using the browser, and Ionic serve will never generate Cordova files, so what is the right way to implement the Facebook login in an Ionic progressive web application.

Phonegap Build using Phonegap Facebook Plugin

I'm using PhoneGap Build. I'm using this plugin here: https://github.com/Wizcorp/phonegap-facebook-plugin only to add install tracking for a Facebook ad I have setup for mobile ads when people install the app after clicking the mobile Facebook ad.
In the Facebook SDK here under "4. Enable Install Tracking": https://developers.facebook.com/docs/app-ads/sdk
it says: "To enable install tracking call the App Events logger once your application becomes active."
In this plugin's README under Events, it says:
"Activation events are automatically tracked for you in the plugin."
Does this mean that there is no code to write, that once I only have to add the plugin to the config xml and it will automatically call FB.AppEvents.activateApp() ?
I have attempted to call FB.AppEvents.activateApp() manually using the Facebook SDK for Javascript but get an error AppEvents undefined.
If you look at the Facebook JS SDK documentation you'll find that it says...
Note: App Launches and App Installs are now logged automatically. It's no longer necessary to call activateApp to log those events.
https://developers.facebook.com/docs/reference/javascript/FB.AppEvents.LogEvent
So the readme for that plugin is correct to say it is automatic.

how to give phonegap app a valid redirect uri

i am begginner in phonegap and using android studio for editing and running phonegap coding
i have to add facebook login in my phonegapp app ,for this i am using openfb.js plugin
link -- https://github.com/ccoenraets/OpenFB
sucessfully integrated all things but when running its showing me valid oauth redirect uri error
what will be "Valid OAuth redirect URIs" if my project file is saved in computer c drive and not on localhost

Cordova / phonegap tracking APPs install with Facebook SDK

Related question: How do I implement Facebook Mobile Install Ad tracking in Phonegap/Cordova project?
I have a working cordova/phonegap application. I would like to track the APP install using the plugin facebook. I installed the cordova facebook connect plugin with:
cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="myappid" --variable APP_NAME="myappname"
The plugin is installed and usable as this report 'true':
alert('fb plugin usable: ' + typeof facebookConnectPlugin != 'undefined')
However I am no seeing anything in the "Most recently logged events" in the facebook developer section for this app. I added the correct Package Name and Class Name in the settings but the events are not just showing up.
Is there anything that I am missing or more info that I can provide ? I cannot find a good tutorial on this that explains the full process.
Should the APP install event just be logged by adding the plugin without any JS call in the app?
I dug a bit in the plugin implementation and noted the activateApp was not implement at all. I cloned the repo and add the functionality for Android [following the FB guide for android ]:
The modifications required on the code are: code changes in plugin and : how to use in the JS code. In this way I can just call
facebookConnectPlugin.activateApp(fb_success, fb_fail);
where the callbacks are just dummy empty function.
and the FB is SDK tracks when there is an installation. I noticed however that the events are generated only when there is a FB app installed on the device [do not know if this is supposed to be like that].
UPDATE
Probably my solution is old, I guess that now the official plugin for Facebook has already the feature implemented directly without the need of any additional customization in the JS files or touching the Java files.

Phonegap's Facebook Connect plugin - making it work with web app as well as native apps?

I've got the FB Connect plugin working with my Phonegap project native apps, but now I'm wondering what the workflow is for making it work with the web-app version.
When I run the web-app version, I get the standard Phonegap FB Connect errors, the last one being 'FB variable does not exist. Check that you have included the Facebook JS SDK file.' - this makes sense, as my web app doesn't have those js files, as they get injected during the PG Build process.
So what is the typical way of moving forward at that point? Can I use that last error as a way of determining 'ok, this is the web-app version, not native', and then what do I do next? Should have the Facebook SDK installed on my web-app?
Cheers
The git repo has steps for including the plugin in web app
Web App
www/js/facebookConnectPlugin.js contains the JavaScript SDK and API file. The API matches as close as possible to the native APIs.
Setup Web App Example
Host the www folder on a server and configure your Facebook dashboard correctly to test the Web APIs. Most people use Parse for easy testing.
NOTE : Developers should call facebookConnectPlugin.browserInit() before login - Web App ONLY
https://github.com/phonegap/phonegap-facebook-plugin