refactor(oauth): put script tag in body (#6958)
This commit is contained in:
16
dist/oauth2-redirect.html
vendored
16
dist/oauth2-redirect.html
vendored
@@ -4,8 +4,6 @@
|
|||||||
<title>Swagger UI: OAuth2 Redirect</title>
|
<title>Swagger UI: OAuth2 Redirect</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
function run () {
|
function run () {
|
||||||
@@ -20,15 +18,15 @@
|
|||||||
qp = location.search.substring(1);
|
qp = location.search.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
arr = qp.split("&")
|
arr = qp.split("&");
|
||||||
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
|
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
|
||||||
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||||
function (key, value) {
|
function (key, value) {
|
||||||
return key === "" ? value : decodeURIComponent(value)
|
return key === "" ? value : decodeURIComponent(value);
|
||||||
}
|
}
|
||||||
) : {}
|
) : {};
|
||||||
|
|
||||||
isValid = qp.state === sentState
|
isValid = qp.state === sentState;
|
||||||
|
|
||||||
if ((
|
if ((
|
||||||
oauth2.auth.schema.get("flow") === "accessCode" ||
|
oauth2.auth.schema.get("flow") === "accessCode" ||
|
||||||
@@ -49,7 +47,7 @@
|
|||||||
oauth2.auth.code = qp.code;
|
oauth2.auth.code = qp.code;
|
||||||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||||
} else {
|
} else {
|
||||||
let oauthErrorMsg
|
let oauthErrorMsg;
|
||||||
if (qp.error) {
|
if (qp.error) {
|
||||||
oauthErrorMsg = "["+qp.error+"]: " +
|
oauthErrorMsg = "["+qp.error+"]: " +
|
||||||
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||||
@@ -73,3 +71,5 @@
|
|||||||
run();
|
run();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user