fix(server): handle token verification errors gracefully

Wrap the verifyLogtoToken promise with a catch block to prevent
unhandled promise rejections. When token verification fails,
return an empty payload instead of throwing an error, ensuring
the application continues to run without crashing.

- Added .catch(() => ({ payload: {} })) to the token verification logic
- Prevents downstream errors when the token is invalid or missing
This commit is contained in:
kyuuseiryuu 2026-03-25 12:04:31 +09:00
parent f7b7216ef1
commit 67457b0f8b

View File

@ -68,7 +68,7 @@ export const verifyLogtoToken = async (headers: Headers | string) => {
// Expected audience token, the resource indicator of the current API
audience: LOGTO_RESOURCE,
}
);
).catch(() => ({ payload: {} }));
// console.debug('Payload', payload);
// Sub is the user ID, used for user identification
return payload