4

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?

Dhaval Rajani
  • 191
  • 1
  • 2
  • 13
  • Did you find this question: http://stackoverflow.com/questions/26356661/facebook-login-on-meteor-mobile-app-cordova – MichelH Sep 12 '15 at 15:48
  • 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 Sep 12 '15 at 15:52
  • yes obviously then and than i can run my app in my device – Dhaval Rajani Sep 12 '15 at 16:02
  • Okay, just checking :) Did you read this question: http://stackoverflow.com/questions/14474122/given-url-is-not-permitted-by-the-application-configuration – MichelH Sep 12 '15 at 16:08
  • how can its help can you tell me? – Dhaval Rajani Sep 12 '15 at 16:21
  • I think your facebook settings on facebook might not 100% accurate. There is an answer: _italic_You need to fill the value for Website with Facebook Login with the value http://localhost/OfferDrive/ to allow Facebook to authenticate that the requests from JavaScript SDK are coming from right place._OfferDrive is this guy's app. And than go to APP base app domain and put in the url. Also, _Settings -> Advanced, add url to "Valid OAuth redirect URIs"._ – MichelH Sep 12 '15 at 16:24
  • i added all configuration in my facebook app. i also specified configuration in my question – Dhaval Rajani Sep 12 '15 at 16:39
  • Did you go to the advanced tab: Settings -> Advanced, add url to "Valid OAuth redirect URIs"? – MichelH Sep 12 '15 at 16:49
  • yes i added https://www.facebook.com/connect/login_success.html,http://localhost:3000/oauthcallback.html,http://localhost:3000/_oauth/facebook?close) – Dhaval Rajani Sep 12 '15 at 17:10

2 Answers2

0

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.

michael
  • 4,031
  • 5
  • 42
  • 67
-1

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.

Dude
  • 1,034
  • 1
  • 14
  • 35
  • thanks i have uploaded on meteor server then i developed app using that url and also add that valid oauthurl but still not getting. But i will try again and let you know – Dhaval Rajani Sep 22 '15 at 20:07
  • 1
    do you run your app via ```meteor run ios-device --mobile-server=http://myrandomname.meteor.com:3000``` after deploying? – Dude Sep 22 '15 at 20:10
  • i will try it again and let you know its my luck if its working – Dhaval Rajani Sep 22 '15 at 20:30