Когда я пытаюсь получить доступ к общедоступной общей таблице (которой я владею), я получаю следующую ошибку. Но только когда я вошел в свою учетную запись Google .
Если я попытаюсь получить доступ к электронной таблице на вкладке режима инкогнито, тогда я смогу прочитать таблицу в полном порядке.
Почему это так?
Я использую google-api-javascript-client/1.1.0
, импортированный с <script async defer src="https://apis.google.com/js/api.js"></script>
.
Это ошибка:
{
"result": {
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"status": "PERMISSION_DENIED"
}
},
"body": "{\n \"error\": {\n \"code\": 403,\n \"message\": \"Request had insufficient authentication scopes.\",\n \"status\": \"PERMISSION_DENIED\"\n }\n}\n",
"headers": {
"date": "Thu, 11 Apr 2019 22:51:12 GMT",
"content-encoding": "gzip",
"www-authenticate": "Bearer realm=\"https://accounts.google.com/\", error=\"insufficient_scope\", scope=\"https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.resource https://www.googleapis.com/auth/spreadsheets https://spreadsheets.google.com/feeds https://spreadsheets.google.com/feeds/ http://spreadsheets.google.com/feeds http://spreadsheets.google.com/feeds/ https://spreadsheets.google.com/feeds/spreadsheets https://spreadsheets.google.com/feeds/spreadsheets/private/full http://spreadsheets.google.com/feeds/spreadsheets/private/full https://spreadsheets.google.com/feeds/worksheets/ https://spreadsheets.google.com/tq https://spreadsheets.google.com/feeds/list/ https://spreadsheets.google.com/feeds/worksheet/ https://spreadsheets.google.com/feeds/cell/ https://www.googleapis.com/auth/spreadsheets.readonly\"",
"server": "ESF",
"content-type": "application/json; charset=UTF-8",
"vary": "Origin, X-Origin, Referer",
"cache-control": "private",
"content-length": "137"
},
"status": 403,
"statusText": null
}
Код, который я используюдля чтения электронных таблиц используются следующие значения, переданные gapi
:
например:
gapi.client.init({
apiKey,
clientId,
discoveryDocs,
scope,
});