Question

Google Picker does not seem to use the OAuth token we pass it to display. It always uses the first logged in account on the user's browser.

I am currently building the picker using something like this:

google_identity = { accessToken: 'oauth token', appId: '12345678',
                    email: 'example@example.com' };
picker = new google.picker.PickerBuilder().
             addView(google.picker.ViewId.DOCUMENTS).
             enableFeature(google.picker.Feature.MULTISELECT_ENABLED).
             enableFeature(google.picker.Feature.NAV_HIDDEN).
             setAppId(google_identity.appId).
             setOAuthToken(google_identity.accessToken).
             setCallback(pickerCallback).
             build();
picker.setVisible(true);

Am I missing something? The App ID I am using is a string of numbers (which seems to be what the documentation is implying) and I am pretty sure my OAuth token has access to Google Drive because I am using the token elsewhere in the application to manipulate files on Google Drive. I also refresh the OAuth token right before building the picker, so the token is definitely current.

A workaround I am currently using now is to have a .setAuthUser(google_identity.email) call, but it's not ideal.

Was it helpful?

Solution

This problem has apparently been fixed by Google. It works as expected now.

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