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" } });