如何让 Swagger 在 Header 和请求 URL 中发送 api_key? [英] How to get Swagger to send api_key in Header and in request URL?

查看:49
本文介绍了如何让 Swagger 在 Header 和请求 URL 中发送 api_key?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将 api 密钥表示为标题或 url 末尾的标签,但我需要两者兼而有之.无论如何,这有可能吗?图片已链接这里

I am able to either get the api key to be represented as a header or as a tag on the end of the url, but I am needing it to be both. Is there anyway for this to be possible? The picture is linked here

推荐答案

window.swaggerUi.api.clientAuthorizations.add(swashbuckleConfig.apiKeyName, new SwaggerClient.ApiKeyAuthorization(swashbuckleConfig.apiKeyName, key, "header"));
      window.swaggerUi.api.clientAuthorizations.add(swashbuckleConfig.apiKeyName + " query", new SwaggerClient.ApiKeyAuthorization(swashbuckleConfig.apiKeyName, key, "query"));

这篇关于如何让 Swagger 在 Header 和请求 URL 中发送 api_key?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆