Google File Picker loading wrong documents when signed into multiple accounts -
we have following scenario:
- user logs google drive account a
- then, user adds new account , logs google drive account b (two active valid accounts @ point)
- while in account b, user clicks create button in drive. our app requests user select account wants use file creation , user selects account b (same 1 using). our app shows file picker files gets see ones in account a, not in account b.
we have followed steps indicated in developers api guide, including setting authorization token. here our createpicker function:
function createpicker() { if (pickerapiloaded && oauthtoken) { new google.picker.pickerbuilder() .addview(google.picker.viewid.docs) .setselectablemimetypes(selectablemimes) **.setoauthtoken(oauthtoken)** .setcallback(pickercallback) .enablefeature(google.picker.feature.multiselect_enabled) .build() .setvisible(true); } }
and how obtaining oauthtoken value:
gapi.auth.authorize({ client_id: clientid, scope: scope, immediate: false, }, function(authresult) { if (authresult && !authresult.error) { **oauthtoken = gapi.auth.gettoken().access_token;** createpicker(); } });
while debugging, have confirmed that, if user selects account a, 1 oauthtoken, , if user selects account b, different one. sending different tokens each account, supposed be.
any idea on why user, after selecting account b (which generates token account b) gets see files on account a? idea of missing or doing wrong?
by default picker show public file ever visited in browser. it's strange behavior , it's hard picker want.
try using feature feature.mine_only
.enablefeature(google.picker.feature.mine_only)
https://developers.google.com/picker/docs/reference#feature
this "show documents owned user when showing items google drive."
Comments
Post a Comment