Skip to content
Snippets Groups Projects
Commit 60620ea1 authored by FERNANDES SAMUEL's avatar FERNANDES SAMUEL :star:
Browse files

jwt verify throw error on false jwt, so try catch it

parent 691e038d
Branches
Tags
No related merge requests found
......@@ -8,9 +8,14 @@ const secret = () => {
};
export const verifyToken = (token: string) => {
return verify(token, secret());
try {
return verify(token, secret());
} catch (error) {
return null;
}
};
export const signIt = (payload: string | Buffer | object) => {
return sign(payload, secret());
};
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment