Commit 85be3ed8 authored by Eirik Alvær's avatar Eirik Alvær

Makes logging of userId more robust.

parent cc522a77
Pipeline #26309 passed with stage
in 20 seconds
{
"name": "@nsd/log-schema-node",
"version": "3.3.0",
"version": "3.3.1",
"main": "lib/index.js",
"types": "lib/index",
"scripts": {
......
......@@ -78,9 +78,13 @@ function getUserId(req: Express.Request) {
}
}
if (auth) {
const res = JwtDecode(auth);
if (res) {
return res.sub;
try {
const res = JwtDecode(auth);
if (res) {
return res.sub;
}
} catch (err) {
return "invalid-jwt"
}
}
}
......
Markdown is supported
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