AngularJS + phonegap: access to Facebook login/SDK without a server

I'm building a webapp (later I will deploy it with Phonegap) with NodeJS at de backend and AngularJS at the front and I'm trying to use Facebook authentication. The Node server runs at localhost:3000 (later it will be at a server on the www) and the AngularJS app runs at localhost:8100. I'm using ngFacebook (https://github.com/GoDisco/ngFacebook) to handle the Facebook SDK.

To use Facebook authentication, it's ok during development to set the App Domain in Facebook to "localhost", it works fine. I can get the access token at the frontend, store it at the backend, check if it's valid, use web tokens to validate the session with Express, etc...

But I can't use app domain to a phonegap app, because it does not run at a server (I guess it runs, at the webview, as file://etc...).

Does anyone know a way to solve it? I took a look in Facebook App Settings that I can add a platform (android, iOS, paget tab?) but I don't think this is the best way. Also, at the Advanced tab there are some options that seems to be to deal with it (I can set if this is a native or desktop app, it gives to me a client token, etc...) but there's nothing at the docs saying what to really do with this.

UPDATE: I solved the problem with Eugenio's answer. I removed the ngFacebook and started to use this implementation http://blog.geniuspods.com/2013/10/15/how-to-use-facebooks-oauth-with-phonegap/ Just a note: loadstart event do not exist in window from desktop browsers (it's only for InnAppBrowser). So, during development, I used postMessage to communicate between the opener window and the popup, becaus they are at different domains.

You have to use InAppBrowser

Basically:

  1. Open a new in-app browser where you login to Facebook in a new window
  2. Register a loadstart event listener with a callback function to trigger when the URL changes
  3. After the login, FB will redirect you to localhost with the access token in the URL. The URL redirect triggers and there you have to parse the access token on the callback method