MrSwitch / hello.js

A Javascript RESTFUL API library for connecting with OAuth2 services, such as Google+ API, Facebook Graph and Windows Live Connect
https://adodson.com/hello.js/
MIT License
4.63k stars 548 forks source link

Redirect uri for desktop applications #191

Open revathykr opened 9 years ago

revathykr commented 9 years ago

I have to create a desktop application for listing all contact details in Google. I created google api key by following the steps below.

  1. Clicked on 'Create new client ID' button.
  2. Selected the option 'Installed application'.
  3. Selected the application type 'Other'.

The result obtained is : CLIENT ID - 'XXXXXXXXXXXXXXXXX' CLIENT SECRET - 'XXXXXXXXXXXX' REDIRECT URIS - urn:ietf:wg:oauth:2.0:oob , http://localhost

What should I give as redirect_uri in 'hello.init' function ?

First I gave ' urn:ietf:wg:oauth:2.0:oob ' and got the Error : invalid_request. Next I gave ' http://localhost ' and got the Error : unsupported_response_type in the popup window.

Can someone please help me to resolve this issue?

MrSwitch commented 9 years ago

Hi @revathykr - sorry for the belated response. I haven't tried defining this as an installed application. I can tell you for Cordova mobile Apps select a web app.

What are you using to build your desktop app?

revathykr commented 9 years ago

I am using node-webkit for my desktop app.

cyraid commented 9 years ago

Hi MrSwitch, I too am struggling with the redirect_uri, but mine is for cordova/phonegap/ionic in this case.. It loads a local file with the "file" protocol, an an error of "invalid_request" with the message "invalid parameter value for redirect_uri: Missing authority: file:///android_asset/www/index.html"

SukantGujar commented 8 years ago

Although this response is very late, I stumbled across a workable solution while perusing the Google OAuth client library. Specifically this code. The idea is to run a local server at a random port, e.g. localhost:78564. Then send http://localhost:78564 as the return URI to the login call. When the login process is over, the local server will get the token back and this can be then shared with hellojs. I guess this will require a custom module which communicates with the local server and hellojs.