{"action":"opened","issue":{"url":"https://api.github.com/repos/springfox/springfox/issues/891","labels_url":"https://api.github.com/repos/springfox/springfox/issues/891/labels{/name}","comments_url":"https://api.github.com/repos/springfox/springfox/issues/891/comments","events_url":"https://api.github.com/repos/springfox/springfox/issues/891/events","html_url":"https://github.com/springfox/springfox/issues/891","id":98920269,"number":891,"title":"Using API Key in header not working. Uncaught TypeError: Cannot read property 'clientAuthorizations' of null","user":{"login":"mrgreen7","id":7460509,"avatar_url":"https://avatars.githubusercontent.com/u/7460509?v=3","gravatar_id":"","url":"https://api.github.com/users/mrgreen7","html_url":"https://github.com/mrgreen7","followers_url":"https://api.github.com/users/mrgreen7/followers","following_url":"https://api.github.com/users/mrgreen7/following{/other_user}","gists_url":"https://api.github.com/users/mrgreen7/gists{/gist_id}","starred_url":"https://api.github.com/users/mrgreen7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrgreen7/subscriptions","organizations_url":"https://api.github.com/users/mrgreen7/orgs","repos_url":"https://api.github.com/users/mrgreen7/repos","events_url":"https://api.github.com/users/mrgreen7/events{/privacy}","received_events_url":"https://api.github.com/users/mrgreen7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-04T08:48:30Z","updated_at":"2015-08-04T08:48:30Z","closed_at":null,"body":"I'm using version 2.1.2 of both springfox-swagger2 and springfox-swagger-ui. I basically copied the example from http://springfox.github.io/springfox/docs/snapshot/#getting-started for using an api key in the header and after many hours of trying I still can not manage to get it to work. I'm access swagger-ui on the same server where my resources are deployed. Thus CORS should not be an issue I guess. When I use the aforementioned sample code I get an error in the console when accessing swagger ui:\r\n\r\n     \"Uncaught TypeError: Cannot read property 'clientAuthorizations' of null\"\r\n\r\n in the html file.\r\n\r\nNeedless to say that no header is set ever when sending any request. Can I even use an api key in the header that I can set manually in swagger-ui using the field in the HTML-header? Because from looking at the Springfox js code it actually seems as if that is not possible:\r\n\r\n         function addApiKeyAuthorization() {\r\n            var key = encodeURIComponent($('#input_apiKey')[0].value);\r\n            log(\"key: \" + key);\r\n            if (key && key.trim() != \"\") {\r\n              var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization(\"api_key\", key, \"query\");\r\n              window.swaggerUi.api.clientAuthorizations.add(\"api_key\", apiKeyAuth);\r\n              log(\"added key \" + key);\r\n            }\r\n          }\r\nHere, \"query\" is hard coded. I'd like to be able to set the api key in the swagger-ui though. Is that possible?\r\n\r\nNb: The aforementioned error occurs in the function above.\r\n"}}