I request the oauth2 authorization in a previous step, so I have the access_token.
I use the token to display a google picker. Everything works but when the user manually revokes my app access from Apps with access to your account the picker object shows the sign in button.
Is it possible to catch this error so I can hide the picker and ask user for re-authorization using my own logic instead of using gapi.load('auth')?
function onApiLoad() {
gapi.load('picker', onPickerApiLoad);
}
function onPickerApiLoad() {
var authBtn = document.getElementById('auth');
authBtn.disabled = false;
authBtn.addEventListener('click', function () {
pickerApiLoaded = true;
createPicker();
});
}
function createPicker() {
if (pickerApiLoaded && oauthToken) {
var docsView = new google.picker.DocsView().
setIncludeFolders(true).
setSelectFolderEnabled(true);
var picker = new google.
picker.PickerBuilder().
addView(docsView).
setOAuthToken(oauthToken).
setDeveloperKey(developerKey).
setCallback(pickerCallback).
build();
picker.setVisible(true);
}
}