From 90fe5e8109bcc3f7c5ae434daa6b247bf1a26c84 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Tue, 9 Apr 2024 10:30:40 +0800 Subject: [PATCH] ignore expiration of jwt token for tts streaming --- packages/text-to-speech/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/text-to-speech/src/index.ts b/packages/text-to-speech/src/index.ts index 506ebf22f..d148204c5 100644 --- a/packages/text-to-speech/src/index.ts +++ b/packages/text-to-speech/src/index.ts @@ -232,8 +232,9 @@ export const textToSpeechStreamingHandler = Sentry.GCPFunction.wrapHttpFunction( let claim: Claim try { - jwt.verify(token, process.env.JWT_SECRET) - claim = jwt.decode(token) as Claim + claim = jwt.verify(token, process.env.JWT_SECRET, { + ignoreExpiration: true, + }) as Claim } catch (e) { console.error('Authentication error:', e) return res.status(401).send({ errorCode: 'UNAUTHENTICATED' })