return failed jwt for debugging auth

master
Avraham Sakal 3 weeks ago
parent 5bd5fbe9dc
commit edfaabeb0d

@ -39,12 +39,14 @@ export const publicProcedure = t.procedure;
export const authProcedure = publicProcedure.use( export const authProcedure = publicProcedure.use(
async ({ ctx: { jwt }, next }) => { async ({ ctx: { jwt }, next }) => {
if (!jwt) { if (!jwt) {
throw new TRPCError({ code: "UNAUTHORIZED" }); throw new TRPCError({
code: "UNAUTHORIZED",
message: JSON.stringify(jwt),
});
} }
if (!jwt.id) { if (!jwt.id) {
throw new TRPCError({ code: "UNAUTHORIZED" }); throw new TRPCError({ code: "UNAUTHORIZED" });
} }
jwt.email;
return await next({ return await next({
ctx: { jwt }, ctx: { jwt },
}); });

Loading…
Cancel
Save