Open ercumentlacin opened 10 months ago
Hi.
@sor4chi Can you handle this issue?
Hi @ercumentlacin
Did you try this "Tips" section written in @hono/zod-openapi? https://github.com/honojs/middleware/blob/main/packages/zod-openapi/README.md#tips
I didn't find it in your code.
You may find this issue helpful. https://github.com/honojs/middleware/issues/261
However, there are so many Bearer authentication-related issues in the Hono Swagger UI that I'm going to have to somehow devise a place to write them. cc: @yusukebe
Hi @ercumentlacin
Did you try this "Tips" section written in @hono/zod-openapi? https://github.com/honojs/middleware/blob/main/packages/zod-openapi/README.md#tips
I didn't find it in your code.
You may find this issue helpful. #261
However, there are so many Bearer authentication-related issues in the Hono Swagger UI that I'm going to have to somehow devise a place to write them. cc: @yusukebe
I looked at the issue you mentioned but it didn't solve my problem.
I wrote the following code to solve my problem and it worked but I don't think this is the right way
export const userApp = new OpenAPIHono({});
userApp.use(userUpdateByIdRoute.path, (c, next) => {
const authToken = c.req.header("authorization");
c.header("authorization", authToken);
return next();
});
// thats works
userApp.openapi(userUpdateByIdRoute, async (c) => {
console.log(c.req.raw.headers);
const { id } = c.req.valid("param");
const input = c.req.valid("json");
const header = c.req.valid("header");
const json = await updateUserByIdService({ id, input });
return c.json(json, StatusCodes.OK);
});
To begin with, when Swagger does Bearer Auth, it is supposed to work by setting the Bearer Token from the Authorization button in the upper right corner of the Swagger UI and then Execute Request in that state, but is it supposed to set the Header in the Field?
Hello Hono/Zod-OpenAPI Team,
I'm encountering an issue with Swagger integration in a route I defined using Hono/Zod-OpenAPI. Specifically, I'm unable to send the "Authorization" header through Swagger's interface. Here's a brief overview of the problem:
Issue Description:
Steps to Reproduce:
Expected Behavior:
Actual Behavior:
Environment:
For your reference, here is the link to the relevant part of my code in my GitHub repository: My Project Code.
I would appreciate any guidance or suggestions on how to resolve this issue. Is this a known problem, or am I missing something in my configuration? Any help would be greatly appreciated.
Thank you for your time and assistance.
Best regards,