fixed zoom video not creating when credentials are not valid (#1329)
* fixed nextcloud * fixed nextcloud & fastmail issues * fixed zoom video not creating when credentials are not valid also fixed reponse to reflect create failure. Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
2 files changed
+5
-7
No files matched your search
@@ -69,7 +69,8 @@ interface ZoomToken {
|
||||
|
||||
const zoomAuth = (credential: Credential) => {
|
||||
const credentialKey = credential.key as unknown as ZoomToken;
|
||||
const isExpired = (expiryDate: number) => expiryDate < Date.now();
|
||||
const isTokenValid = (token: ZoomToken) =>
|
||||
token && token.token_type && token.access_token && (token.expires_in || token.expiry_date) < Date.now();
|
||||
const authHeader =
|
||||
"Basic " +
|
||||
Buffer.from(process.env.ZOOM_CLIENT_ID + ":" + process.env.ZOOM_CLIENT_SECRET).toString("base64");
|
||||
@@ -107,7 +108,7 @@ const zoomAuth = (credential: Credential) => {
|
||||
|
||||
return {
|
||||
getToken: () =>
|
||||
!isExpired(credentialKey.expires_in || credentialKey.expiry_date)
|
||||
!isTokenValid(credentialKey)
|
||||
? Promise.resolve(credentialKey.access_token)
|
||||
: refreshAccessToken(credentialKey.refresh_token),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user