How to integrate google contacts api in node webkit - google-api

I need to integrate google contacts import in my nw.js app. How should I create the google app ? When I create the app as web app, it asks for redirect uri which is not available for desktop apps. I'm not clear about how to implement google integration for desktop apps. Can anyone help me on this. ?

There is an option in OAuth for desktop applications, when instead of http://domain you will redirect to app://something and you application will be started or receive a callback.
To make this, in your application you need to open request token url in new window (new window in your node-webkit app).
Also: google docs and node-webkit github issue and other issue about this.
For me I thought better would be open a default browser, there is a high chance that user already authenticated, and then just need to click "allow". So I start simple webserver inside node-wekit app and redirect to localhost.
You can see implementation in my project https://github.com/Paxa/postbird/blob/90cfb53b1775310eb2f262c8b54c9dba15b5cc0a/app/heroku_client.js#L185
To open default browser I use command "open" (only for mac)
child_process.spawn('open', [url]);
I also try to close browser window when user redirected back, it works but not always.
response.writeHead(200, {"Content-Type": "text/html"});
response.end("<script type='text/javascript'>window.close();</script>");
May be I should also make a window active when receive redirect back (didn't try it yet):
var currentWin = require('gui').Window.get();
currentWin.focus();
If google not allows to make localhost as a callback url, you can try to use some domain (even free) and point it to 127.0.0.1 or use http://readme.localtest.me/

Related

Google oauth with custom URI-scheme redirect_uri using system browsers

Google just changed their oauth model to the new specification:
Modernizing OAuth interactions in Native Apps for Better Usability and Security
I am trying to follow (specifically section 7 of) the ietf "draft-ietf-oauth-native-apps-09" linked in the above blog, and also this reference from google:
OAuth 2.0 for Mobile & Desktop Apps
The issue I have encountered is that the custom uri-scheme behavior varies across browsers, and in some cases does not work as expected. In Firefox, which maybe be the default system browser, the app actually open inside Firefox, embedded - it does not return to the app it embeds the app in the browser, while the app from which the authentication flow was started remains open.
In chrome, it correctly redirects back to the app, however the chrome page with the authentication confirmation page remains open and does not close, which could be confusing to users.
How can I make sure that the oauth provider will always redirect to my app (without the browser embedding it), and close the tab or window which had the authentication flow open?

How to make OSX Yosemite webviews work with ADFS

I'm using a webview to host a log in page that redirects to an ADFS server to offer single sign on. This works on 10.9, but I noticed for OSX 10.10 I am able to get to the point where the ADFS server will present an http authentication challenge, the webview will show the default dialog to enter credentials, but after entering the credentials I never see the expected redirects that eventually allow the single sign on process to complete. Even if I cancel the webview prompt to login, I never receive a didReceiveResponse message (in the WebResourceLoadDelegate protocol).
Does anyone know of any changes in the webview for 10.10 that may cause it to stop sending/receiving requests/responses like this?
Update: It looks like this issue is a problem with WebViews and HTTP Basic Authentication in general. I have created a simple mac application with a single web view, and pointed it to a apache web server with a folder protected by an .htaccess file. While the app is able to successfully view the actual web page after the user enters their credentials in the login prompt on 10.9, on 10.10 this fails in the same manner as described above.

How to make inappbrowser URL visible in a cordova windows phone application

I am working on a windows phone app. I am using the cordova framework. One of the functionalities of the app is to allow users make donations. I already have an hosted website for this so what I simply want to do is to allow the app users access this site using inappbrowser. The problem is that windows rejected the app with the following comments:
The user is prompted for payment information from within the app. Transactions must occur external to the app via a secure (HTTPS) website, or through a hosted control where the address bar is visible to verify the URL and HTTPS security.
So I need to know if there is a way I could make the address bar visible...Any other possible workaround to this problem will be really appreciated. Thanks

how to get authorization code to my wp app for google authentication?

In my WP7.5 app, I have redirect the user to google web page where is asked to giving the app permissions to access to his account, user click yes, but it redirects to a page where there is the code and user is supossed to copy/paste that to my app.
The Response is
Please copy this code, switch to your application and paste it there:
4/3oHAHtqSk1CqA3S8HlEsuQRaE08e.4nCBpXhR-R8WgrKXntQAax02U4CwcgI - Auth code
I want to, when user press ok, return to my app with that code, is there any way to do that?
-SheikAbdullah
If you're using the Browser control, here's a great CodeProject article on how to do it:
Google OAuth2 on Windows Phone

How to create an FB app without a secure canvas URL

I have a simple app I want to create, which allows you to place any website within your Facebook page on a tab.
Previously, I could just do this without a secure canvas URL, but now it is telling me that I must have this to create the app.
Is there a way around this, as the app does not take any info from anybody, it just shows a site from my server on the page.
Short answer: No. You do not need to provide an encrypted connection if the app runs in sandbox mode but otherwise it is mandatory.
Well, actually people using secure browsing will just see an error message at the moment but judging from recent announcements apps without an encrypted connection will be blocked a bit further down the road.

Resources