Question

Our application is built with node-webkit and we'd like to add an authentication layer.
We could use node-webkit as a regular browser and hit our website (ie redirecting to http://www.oursite.com) but we'd loose all the interest of webkit. The point here is to authenticate the user from the start, ie with the local url which should look like *file:///C:/Users/ALEXAN~1/AppData/Local/Temp/nw7628_20315/index.html*

According to this question, we can use fb authentication should work.

But is there a way to use oauth? The two solutions that came to my mind are:

  • using an iframe inside the page but oauth providers refuses such requests
  • Calling directly oauth with our local return url (file:///...) but redirections to local files are forbiden too in browsers (hence in webkit).

It might be a pretty general question but anything I'm missing with oauth/node-webkit?
If it's impossible, how would you authenticate users in such an app?

Was it helpful?

Solution

Don't use client-side oauth, make it through the "server side" of node-webkit. That means, you can popup a window, redirect it, close it when you are done. All the necessary information you need to pass using the request library, or API SDK for the Facebook oauth.

Part of this process I've posted in here window.open without popup blocker using AJAX and manipulating the window.location

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top