You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the JWT middleware, end users currently cannot specify the type for the payload. The context variable is set to jwtPayload: any, and there have been multiple discussions by people on Discord asking how to set the types. It cannot be overridden in ContextVariableMap, so the only way to set it is by casting.
I am proposing that we either incorporate generic type parameters, for example, jwt<MyPayloadType>({ secret: '123' }), which can be backwards compatible.
Or we remove the following:
interfaceContextVariableMap{jwtPayload: any;}
And force the user to set the context variables themselves.
The text was updated successfully, but these errors were encountered:
@yusukebe Any chance to make JwtPayload not global? I have an app which use different auth middleware for different routes, but as long as I import hono/jwt, every context have the ts type of JwtPayload, which may lead to runtime error.
What is the feature you are proposing?
When using the JWT middleware, end users currently cannot specify the type for the payload. The context variable is set to
jwtPayload: any
, and there have been multiple discussions by people on Discord asking how to set the types. It cannot be overridden in ContextVariableMap, so the only way to set it is by casting.I am proposing that we either incorporate generic type parameters, for example,
jwt<MyPayloadType>({ secret: '123' })
, which can be backwards compatible.Or we remove the following:
And force the user to set the context variables themselves.
The text was updated successfully, but these errors were encountered: