2
votes

I am trying to use Google Drive (https://developers.google.com/drive/v2/reference/) inside my phonegap app.

Now I currently having the problem, after setting up an "Client ID for installed applications", that api requests from file:// are not supported? Or they not allowed?

The following code ends end with 400 Bad Request: gapi.auth.authorize({ 'client_id' : CLIENT_ID, 'scope' : SCOPES, 'immediate' : false }, handleAuthResult);

The called URL https://accounts.google.com/o/oauth2/auth?client_id=XXX&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&immediate=true&proxy=oauth2relay427605398&redirect_uri=postmessage&origin=file%3A%2F%2F&response_type=token&state=2033446467%7C0.4181954479&authuser=0 does not work with origin file?

Can I allow access from file scope? Or how to use this inside a phonegap container.

1

1 Answers

0
votes

I don't believe you can use file:// as an origin. I have not found an example of using phonegap in this way.

You can however use a childbrowser and make an authenticated request from it and pass it back to your browser. There is a post and an example app using Google Tasks at the links below.

http://www.itsalif.info/content/oauth-google-api-gapi-phonegap-childbrowser-jquery

https://github.com/liquidlabs/phonegap-oauth-google-api-mobile