gnext icon indicating copy to clipboard operation
gnext copied to clipboard

Authorization header didn't pass to Swagger UI

Open Otetz opened this issue 1 year ago • 4 comments

In documentation present good sample of authorization middleware. But this sample don't work in Swagger UI because Authorization header not used.

Internet research says It must be defined as a security scheme, not a header parameter.

Otetz avatar May 07 '23 18:05 Otetz

Hi @Otetz,

We are aware of this and it is on our roadmap for the nearest future. However the situation is a bit complicated, since the security schema should be connected to the middleware. The API can be secured using different approaches - JWT tokens, api keys etc. So it depends on how the exact endpoint is secured. We plan to extend middlewares by documentation addons and add some predefined commonly used middlewares with well defined security schemas. We appreciate any ideas of implementation.

meteran avatar May 08 '23 07:05 meteran

I think is possible to use go docs for enrich auto-generated documentation. I plan to suggest this feature separately, but i think this may be used for describe security options in this case also.

Otetz avatar May 08 '23 10:05 Otetz

I've merged the docs extension PR and made a release (v0.10.0). @Otetz, can I close this issue?

meteran avatar May 17 '23 11:05 meteran

Almost yes, but i think somebody need to rework documentation to describe this.

Otetz avatar May 17 '23 17:05 Otetz