Используя gapi.client.request, я могу успешно получить данные с Диска.
Однако, если я аннулирую токен доступа и повторю попытку, я получу 401, как и ожидалось, за которым следует вызов https://accounts.google.com/o/oauth2/auth?scope=&immediate=true&proxy.=oauth2relay530384583&redirect_uri=postmessage&origin=http%3A%2F%2Fdev.myapp.co%3A9000&response_type=token&state=780297101%7C0.3257751071&authuser=0
который терпит неудачу 400 «Отсутствует обязательный параметр: область действия»
Глядя на URL-адрес, область действия действительно пуста, но почему?
В начале аутентификации я устанавливаю свои области с помощью массива, таким образом...
var scopes = [ 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/drive.file', 'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile', "https://docs.googleusercontent.com/", "https://docs.google.com/feeds/",
"https://www.googleapis.com/auth/drive.install","https://www.googleapis.com/auth/tasks" ];
Сам код...
var request = gapi.client.request({
'path': '/drive/v2/files/'+qObject.id,
'method': 'GET',
'params': {'maxResults': '1'}
});
request.execute(function(resp) {
console.log(resp); // this get works as expected
});
// now invalidate the access token
var token=gapi.auth.getToken();
token.access_token = "foo";
gapi.auth.setToken(token);
request = gapi.client.request({
'path': '/drive/v2/files/'+qObject.id,
'method': 'GET',
'params': {'maxResults': '1'}
});
request.execute(function(resp) {
console.log(resp); // this fails with a 401 as expected, but fails to get a new token
});