I am using GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}
to get some data from my Google Sheets by using fetch API + Sheet v4 API
let fetch_url = "https://sheets.googleapis.com/v4/spreadsheets/1UOaYEl8i33Bco5PaIXAljWkPFmt3j3i1tohXwNl3vvs?key=" + apiKey
let fetch_option = {
method: 'GET',
headers: {
Authorization: `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
}
fetch(fetch_url,fetch_option)
.then(res => function(res){
console.log(res.JSON())
})
But I have received 401 when I am running this fetch function. May I know what am I missing?
"permissions":[
"activeTab",
"identity",
"http://*/"
],
"background":{
"scripts":["src/script/background.js","src/script/jsrsasign-all-min.js"],
"persistent": false
},
"oauth2": {
"client_id": "Client ID",
"scopes":["https://www.googleapis.com/auth/spreadsheets",
"https://sheets.googleapis.com/v4/spreadsheets/*"]
}