From 94586074355aacee119910194e5abbaf91568ad5 Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Sat, 7 May 2022 16:48:13 +0200 Subject: [PATCH] Also return expiration --- src/common.js | 2 +- src/getAlbums.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common.js b/src/common.js index f98959b..b053e51 100644 --- a/src/common.js +++ b/src/common.js @@ -19,5 +19,5 @@ export async function getToken() { headers: {'Content-Type': 'application/json'} }); const data = await response.json(); - return data.access_token; + return [data.access_token, data.expires_in]; } \ No newline at end of file diff --git a/src/getAlbums.js b/src/getAlbums.js index 0923d8c..af893a7 100644 --- a/src/getAlbums.js +++ b/src/getAlbums.js @@ -21,7 +21,7 @@ const rl = readline.createInterface({ do { const response = await fetch(`https://photoslibrary.googleapis.com/v1/albums?pageSize=50${nextPageToken ? `&${nextPageToken}`: ""}`, { headers: { - Authorization: `Bearer ${await getToken()}`, + Authorization: `Bearer ${(await getToken())[0]}`, "Content-Type": "application/json" } });