DocsUploadView and setOAuthToken causing "undefined Dismiss" error

300 views
Skip to first unread message

Jesse von Doom

unread,
Jan 2, 2013, 7:56:46 PM1/2/13
to google-p...@googlegroups.com
Hi,

I'm building a webapp where a user can Authorize via OAuth2 and choose/upload files from their own Drive for later use. Essentially we're just storing the file ID and using the API to access them later. Everything is working fine when I use .setAuthUser() and require users to be logged in independent of our app, but when we use .setOAuthToken() instead only the file picker works — the DocsUploadView panel returns an "undefined" error.

This behavior is consistent across Firefox/Chrome/Safari and with or without a current user login. It's always able to see files, never able to upload them. We are requesting full drive scope but even with that we're seeing errors.

For now we're just using setAuthUser as a workaround but this causes extra steps and a few problems when a user isn't logged in. Is it possible to use setOAuthToken with DocsUploadView?

The picker builder code I'm using is below, with IDs and tokens in the same format I'm using but altered for security.

Thanks!

var view = new google.picker.View(google.picker.ViewId.DOCS);
var uploadview = new google.picker.DocsUploadView();  
var picker = new google.picker.PickerBuilder()
     .enableFeature(google.picker.Feature.MINE_ONLY)
     .disableFeature(google.picker.Feature.NAV_HIDDEN)
     .disableFeature(google.picker.Feature.MULTISELECT_ENABLED)
     .setAppId('987654321098')
     .setOAuthToken('ya31.AIER6DRhxRgRsT0SoGPoaxPMhDd0n3OHKj43SJaG5kFndZ52')
     .addView(uploadview)
     .addView(view)
     .setCallback(pickerCallback)
     .build();
picker.setVisible(true);

C. Scott Ananian

unread,
Jan 10, 2013, 10:40:27 AM1/10/13
to google-p...@googlegroups.com
On Wednesday, January 2, 2013 7:56:46 PM UTC-5, Jesse von Doom wrote:
     .setAppId('987654321098')

Shouldn't the appid be a full domain name?  Ie, '987654321098.apps.googleusercontent.com'?
  --scott

Jesse von Doom

unread,
Jan 10, 2013, 11:47:16 AM1/10/13
to google-p...@googlegroups.com
I've tried it both ways with the same result. On the "API Access" page the ID has the full apps.googleusercontent.com listed as the client ID, and on the "Drive SDK" page it lists App ID as just the number. Whichever I use I get the same result: I can browse and select from existing files, but upload gives the "undefined" error message.

j

Jesse von Doom

unread,
Jan 11, 2013, 7:16:40 PM1/11/13
to google-p...@googlegroups.com
Got an answer, but it looks like this just isn't possible right now. No OAuth support for uploads yet, though an internal feature-request is in the works. Details: http://stackoverflow.com/a/14288680/1964808
Reply all
Reply to author
Forward
0 new messages