Im use
https://www.npmjs.com/package/vue-googleapis
https://developers.google.com/picker/docs#example
For some reason, one user can successfully call a modal window to select files. If he is unauthorized, then he is prompted to enter, otherwise he immediately sees the files. And other users have an obscure error, which after a couple of clicks turns into 400.
const googleUser = this.$google.api.auth2.getAuthInstance().currentUser.get();
googleUser.reloadAuthResponse().then(
(authResponse) => {
this.createPicker(authResponse);
},
);
createPicker(authResult) {
const { access_token } = authResult;
if (authResult && !authResult.error) {
this.$google.api.load('picker', () => {
// eslint-disable-next-line no-undef
const view = new google.picker.View(google.picker.ViewId.DOCUMENTS).setMimeTypes('application/vnd.google-apps.document');
// eslint-disable-next-line no-undef
const picker = new google.picker.PickerBuilder().
// eslint-disable-next-line no-undef
enableFeature(google.picker.Feature.MULTISELECT_ENABLED).
addView(view).
setOAuthToken(access_token).
setAppId('rescriptdev').
setDeveloperKey('!THIS REAL KEY!!').
setCallback((data) => this.pickerCallback(data, access_token)).
build();
picker.setVisible(true);
});
}
},