Save refresh token (#7661)

This commit is contained in:
Joe Au-Yeung 2023-03-10 11:42:20 -05:00 committed by GitHub
parent f3360e6476
commit 7b21839c73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -217,8 +217,13 @@ export default class Office365CalendarService implements Calendar {
client_secret,
}),
});
const responseBody = await handleErrorsJson<{ access_token: string; expires_in: number }>(response);
const responseBody = await handleErrorsJson<{
access_token: string;
expires_in: number;
refresh_token: string;
}>(response);
o365AuthCredentials.access_token = responseBody.access_token;
o365AuthCredentials.refresh_token = responseBody.refresh_token;
o365AuthCredentials.expiry_date = Math.round(+new Date() / 1000 + responseBody.expires_in);
await prisma.credential.update({
where: {