4
votes

I'm implementing facebook login with cordova app, but I'm not able to understand which configuration needed to do in facebook app for this facebook login using meteor cordova. I've done the following steps:

  1. create app
  2. add website as platform
  3. add Valid OAuth redirect URIs(https://www.facebook.com/connect/login_success.html,http://localhost:3000/oauthcallback.html,http://localhost:3000/_oauth/facebook?close)
  4. add website url ("http://localhost:3000")
  5. added phonegap facebook connect plugin
  6. below code in my mobile-config.js

    App.configurePlugin('com.phonegap.plugins.facebookconnect', { APP_ID: '', APP_NAME: '' });

  7. I added following code in settings.json file

    "facebook": { "appId": "", "secret": "" }

  8. I added this code at server side js

    ServiceConfiguration.configurations.insert({ service: 'facebook', appId: '', secret:"" });

I'm able to login in web but not able to login in cordova app. i'm getting following error

given url is not allowed by the application configuration : one or more of the given URLs is not allowed by the app’s settings. To use ths URL you must add a valid native platform in your app’s settings

can anyone help me to config my facebook app?

2
Did you find this question: stackoverflow.com/questions/26356661/… - MichelH
yes i used same cordova phongap plugin. i am able to open facebook login page but there is one error given url is not allowed by the application configuration : one or more of the given URLs is not allowed by the app’s settings. To use ths URL you must add a valid native platform in your app’s settings - Dhaval Rajani
yes obviously then and than i can run my app in my device - Dhaval Rajani
Okay, just checking :) Did you read this question: stackoverflow.com/questions/14474122/… - MichelH
how can its help can you tell me? - Dhaval Rajani

2 Answers

0
votes

I had the same problem. I had a previous problem with <allow-navigation /> tags in my config.XML file which had me looking for the answer in the wrong place. But a closer read says it all,

...To use ths URL you must add a valid native platform in your app’s settings

The solution for me was to add an iOS Platform to your Facebook App from the Settings page. Make sure you add the correct app bundleID and flip the oauth switch to Yes

BTW, I used thecordova-plugin-facebook4 plugin from this repository https://github.com/jeduan/cordova-plugin-facebook4, and I believe it uses the native SDK whiche completely skips the redirect_uri. However, I am also using plain accounts-facebook for loginWithFacebook() from web browsers, and that does require the redirect_uri setting.

-1
votes

I had exactly the same problem.

Solution:

you can't use your local development environment (localhost) to do a Facebook login with a meteor/cordova build. This is just working on your desktop machine. You have to deploy your app to your own server or to the meteor test servers via

meteor deploy myrandomname.meteor.com

also add via www.developers.facebook.com

(basic page)

app domain:

myrandomname.meteor.com

(advanced page) valid OAuth redirect URIs:

http://myrandomname.meteor.com:3000/_oauth/facebook?close

also don't forget that you are the only one who can login when the app is in test mode. if you would like to allow other people to login while in test mode you have to invite them also via developers.facebook.com to your app.