I have a question.
My API need token authentication.
How should I set header key "Authorization" on swagger doc?
my code:
// @Description api
// @Accept json
// @Produce json
// @Content-Type application/json
// @Param sendBody body apimodel.ExamplePost true "body"
// @Success 200 {string} apimodel.Response "ok"
// @Failure 400 {object} apimodel.Response "Bad Request"
// @Router /v1/example/testpost [post]
You can reference https://swaggo.github.io/swaggo.io/declarative_comments_format/api_operation.html#security and https://github.com/swaggo/swag/blob/master/testdata/simple2/main.go more detail example.
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name Authorization
func main() {
}
// @Security ApiKeyAuth
// @Router /api/v1/list [get]
func list() {
}
Does this not work with OAuth2Implicit? My header is not being sent after authentication @easonlin404
Most helpful comment