4
votes

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
The client-side SDK can login and get an auth token without a page refresh. - josh3736
using the unmodified code from the tutorial-page: Failed to load resource file://connect.facebook.net/en_US/all.js ... crossdomain problem? i just removed the channel-attribute (don't have a URI), and set my correct AppID. - Maximilian Stroh
You'll have to use an absolute URL rather than the protocol-relative one from the docs. Modify js.src = "//connect.facebook.net/... to https://connect.facebook.net/... - josh3736
Okay, done. Now the Crossdomain-stuff: "One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains." - Maximilian Stroh
seems that my problem with the client sdk is the following: i simply can't register a url in the facebook-app-settings, and obviously facebook checks if the requesting client matches this url. Isn't there something like "ANY" which i can write there intead of an url? - Maximilian Stroh

1 Answers

3
votes

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.