facebook login using meteor cordova app

给你一囗甜甜゛ 提交于 2019-12-07 11:25:59

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/32539886/facebook-login-using-meteor-cordova-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!