-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swagger 2.0 apikey authorization #3318
Comments
I init my Swagger UI When I load the page with the swagger UI documentation, I preload my authorization value into an HTML input field and the I add the api_key authorization header in this way In some cases I manage also the logout in this way |
Thanks for the reply. I tried using ui.authAction.authorize but it still doesn't take effect. window.onload = function() { |
Maybe depends on the wrong name of your authorization spec? Are you sure that is 'api_key'? |
Thanks zem83. I couldn't get the Header Bearer token to work but the access_token with query works for now with ui.authActions.authorize(). |
Good :) |
Make sure api_key name is match what is defined in 'securityDefinitions' |
I've the same issue to solve. What is my problem?
SwaggerUI says still: curl -X GET "http://localhost:8080/api/contact/" -H "accept: /" without any header information. |
Closing due to inactivity. This is simply to keep our issue tracker clean - feel free to comment if there are any further thoughts or concerns, and we'll be happy to reopen this issue. |
I am trying to set api key but the Swagger 2.0 UI does not reflect the header info in the curl.
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
url: "http://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
onComplete: function(swaggerApi, swaggerUi, initOAuth){
$("pre code").each(function(i, e) {hljs.highlightBlock(e)});
var authKey = new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer d88fb9b5-8625-4731-85db-99d6f2647a2e', 'header');
window.swaggerUi.api.clientAuthorizations.add("api_key", authKey);
},
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
The text was updated successfully, but these errors were encountered: