Yes, you can use the Drive API, but you need to use the Google JS client, just specify the scope, client ID, client secret and load the js client and make API calls. But the JavaScript source should have your chrome extension id (chrome-extension: // abcdefghijklmnopqrstuvwxyx)
The below features may be convenient for you.
var handleClientLoadAuto = function () {
gapi.client.setApiKey(apiKey);
window.setTimeout(checkAuthAuto, 1);
}
and
var checkAuthAuto = function () {
gapi.auth.authorize({
client_id: clientId,
scope: 'scope here',
immediate: true
}, handleAuthResultAuto);
}
and if everything is fine:
var handleAuthResultAuto = function (authResult) {
if (authResult && !authResult.error) {
gapi.client.load('drive', 'v2', function () {
var request = gapi.client.drive.files.list(params);
request.execute(function (resp) {
if (resp && resp.error) {
} else {
}
});
}
} else {}
}
But for this you need to log in, otherwise it will not detect authorization.
source
share