fix(oauth2): generate default oauth2RedirectUrl based on page location and path (#7476)

Co-authored-by: Tim Lai <timothy.lai@gmail.com>
This commit is contained in:
Anne Stellingwerf
2022-02-02 01:25:52 +01:00
committed by GitHub
parent a0e9923dd5
commit a89c90ec77
3 changed files with 86 additions and 1 deletions

View File

@@ -31,7 +31,7 @@ export default function SwaggerUI(opts) {
maxDisplayedTags: null,
filter: null,
validatorUrl: "https://validator.swagger.io/validator",
oauth2RedirectUrl: `${window.location.protocol}//${window.location.host}/oauth2-redirect.html`,
oauth2RedirectUrl: `${window.location.protocol}//${window.location.host}${window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/"))}/oauth2-redirect.html`,
persistAuthorization: false,
configs: {},
custom: {},