iEmix
iEmix
HHono
Created by iEmix on 8/13/2024 in #help
How to add custom message to error Bearer Auth
export const auth = bearerAuth({
verifyToken: async (accessToken: string, c: AppContext) => {
try {
const jwtPayload: JWTPayload = await verifyAccessToken(accessToken);
const user: AuthUser = jwtPayload.user as AuthUser;
c.set('user', user);
} catch (err) {
return false;
}

return true;
},
});
export const auth = bearerAuth({
verifyToken: async (accessToken: string, c: AppContext) => {
try {
const jwtPayload: JWTPayload = await verifyAccessToken(accessToken);
const user: AuthUser = jwtPayload.user as AuthUser;
c.set('user', user);
} catch (err) {
return false;
}

return true;
},
});
I want add custom message when failed for example, JWT Access token expired
2 replies
HHono
Created by iEmix on 8/8/2024 in #help
Zod why error
No description
4 replies
HHono
Created by iEmix on 8/7/2024 in #help
Context how it work?
export type AuthUser = { id?: number name?: string; email?: string; }; i want have c.get('user'); and c.set('user', authUser); but i recive Argument type "user" is not assignable to parameter type keyof E["Variables"] and Argument type "user" is not assignable to parameter type keyof E["Variables"] #context
2 replies