Node-Webkit Facebook integration

2020-07-18 06:18发布

问题:

I am building a newsreader-ish desktop app using node-webkit

https://github.com/rogerwang/node-webkit

which is basically server and client at the same time. My Problem with the facebook API is the following: i want the user of my app to login and present them their current wall-postings and the stuff like this. In addition, i have a couple of news-items from other sources, which should be like-able/share-able from this user.

The whole app is a single-page JS (more exactly: coffeescript) thing with multiple components, a hard redirect is impossible.

Every login-possibility shown in the API seems not suited for my type of application. What is the best way to connect to facebook, without having a hard redirect and without an own URI to redirect to?

回答1:

If you're developing a standalone client application, not a website, I wouldn't try to use their Javascript API, because it assumes it's being run on some website.

You might have more luck with the unofficial Node.js APIs, seeing as node-webkit allows you to make calls to any Node.js library from within the DOM.

If you still have no success, try letting the user log into Facebook itself, presenting its login page in an <iframe>. Then you might be able to make HTTP calls, either through AJAX or through Node.js HTTP APIs, to call Facebook's internal APIs directly.