Also return expiration

This commit is contained in:
Daniel Kluge 2022-05-07 16:48:13 +02:00
parent 8cfcb72f0c
commit 9458607435
2 changed files with 2 additions and 2 deletions

View File

@ -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];
}

View File

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