From: Ardis Lu Date: Sun, 29 Jan 2023 07:56:06 +0000 (-0800) Subject: Move OAuth scopes into the function X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=4cc4970f6df0e02381a82f4804bfc5aeede4a787;p=ardislu.dev Move OAuth scopes into the function --- diff --git a/functions/atom.xml.js b/functions/atom.xml.js index c97b677..2bb6134 100644 --- a/functions/atom.xml.js +++ b/functions/atom.xml.js @@ -3,7 +3,7 @@ import { getGoogleAuthToken } from './auth.js'; export async function onRequestGet({ env }) { const entries = []; const updatedDates = []; - const token = await getGoogleAuthToken(env.EMAIL, env.PRIVATE_KEY, env.SCOPES); + const token = await getGoogleAuthToken(env.EMAIL, env.PRIVATE_KEY, 'https://www.googleapis.com/auth/spreadsheets.readonly https://www.googleapis.com/auth/documents.readonly'); const sheetUrl = 'https://sheets.googleapis.com/v4/spreadsheets/1pfGF8yBu3D0GPTezygLuzu3Cif8SkjhtG98nL-czlhc/values/B3:I'; await fetch(sheetUrl, { headers: { Authorization: `Bearer ${token}` } }) .then(r => r.json())