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:
parent
f7b7216ef1
commit
67457b0f8b
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user