diff --git a/README.md b/README.md
index 19de159a..222ab710 100644
--- a/README.md
+++ b/README.md
@@ -124,12 +124,12 @@ Header params are supported through a pluggable mechanism in [swagger-js](https:
$('#input_apiKey').change(function() {
var key = $('#input_apiKey')[0].value;
if(key && key.trim() != "") {
- swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("api_key", key, "header"));
+ swaggerUi.api.clientAuthorizations.add("auth_name", new SwaggerClient.ApiKeyAuthorization("api_key", key, "header"));
}
})
```
-This will add header `api_key` with value `key` on every call to the server. You can substitute `query` to send the values as a query param.
+This will add the header `api_key` with value `key` on calls that have the `auth_name` security scheme as part of their swaggerDefinitions. You can substitute `query` to send the values as a query param.
### Custom Header Parameters - (For Basic auth etc)
If you have some header parameters which you need to send with every request, use the headers as below:
diff --git a/dist/lib/swagger-oauth.js b/dist/lib/swagger-oauth.js
index 2bb6be11..a35bda3c 100644
--- a/dist/lib/swagger-oauth.js
+++ b/dist/lib/swagger-oauth.js
@@ -250,11 +250,19 @@ function clientCredentialsFlow(scopes, tokenUrl, OAuthSchemeKey) {
window.processOAuthCode = function processOAuthCode(data) {
var OAuthSchemeKey = data.state;
+
+ // redirect_uri is required in auth code flow
+ // see https://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1.3
+ var host = window.location;
+ var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
+ var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
+ var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
+
var params = {
'client_id': clientId,
'code': data.code,
'grant_type': 'authorization_code',
- 'redirect_uri': redirect_uri
+ 'redirect_uri': redirectUrl
};
if (clientSecret) {
diff --git a/dist/swagger-ui.js b/dist/swagger-ui.js
index c6b7296a..b6e76790 100644
--- a/dist/swagger-ui.js
+++ b/dist/swagger-ui.js
@@ -434,7 +434,7 @@ this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(dept
+ "\" data-sw-translate>Terms of service";
},"6":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
- return "
";
},"8":function(depth0,helpers,partials,data) {
@@ -19668,6 +19668,10 @@ SwaggerUi.Views.AuthButtonView = Backbone.View.extend({
content: this.$authEl
};
+ // The content of the popup is removed and all events unbound after clicking the 'Cancel' button of the popup.
+ // We'll have to re-render the contents before creating a new popup view.
+ this.render();
+
this.popup = new SwaggerUi.Views.PopupView({model: authsModel});
this.popup.render();
},
diff --git a/dist/swagger-ui.min.js b/dist/swagger-ui.min.js
index 675ca274..d5ed02da 100644
--- a/dist/swagger-ui.min.js
+++ b/dist/swagger-ui.min.js
@@ -1,10 +1,10 @@
-(function(){function e(){e.history=e.history||[],e.history.push(arguments),this.console&&console.log(Array.prototype.slice.call(arguments)[0])}this.Handlebars=this.Handlebars||{},this.Handlebars.templates=this.Handlebars.templates||{},this.Handlebars.templates.apikey_auth=Handlebars.template({1:function(e,t,n,i){var r,a="function",o=t.helperMissing,s=this.escapeExpression;return' '+s((r=null!=(r=t.value||(null!=e?e.value:e))?r:o,typeof r===a?r.call(e,{name:"value",hash:{},data:i}):r))+"\n"},3:function(e,t,n,i){return' \n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,i){var r,a,o="function",s=t.helperMissing,l=this.escapeExpression,u='