Skip to content

Commit ec81d25

Browse files
committed
Merge pull request #532 from Antek-drzewiecki/oauth_redirect_url_fix
Fixed oauth redirect url path. URL works with nested pathnames.
2 parents ee19963 + 2b08c0e commit ec81d25

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/swagger-oauth.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ function handleLogin() {
7474

7575
var authSchemes = window.swaggerUi.api.authSchemes;
7676
var host = window.location;
77-
var redirectUrl = host.protocol + '//' + host.host + "/o2c.html";
77+
var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
78+
var redirectUrl = host.protocol + '//' + host.host + pathname + "/o2c.html";
7879
var url = null;
7980

80-
var p = window.swaggerUi.api.authSchemes;
81-
for (var key in p) {
82-
if (p.hasOwnProperty(key)) {
83-
var o = p[key].grantTypes;
81+
for (var key in authSchemes) {
82+
if (authSchemes.hasOwnProperty(key)) {
83+
var o = authSchemes[key].grantTypes;
8484
for(var t in o) {
8585
if(o.hasOwnProperty(t) && t === 'implicit') {
8686
var dets = o[t];

0 commit comments

Comments
 (0)