diff --git a/web/src/auth/AuthCallback.js b/web/src/auth/AuthCallback.js index b80ff81f..9fcb7275 100644 --- a/web/src/auth/AuthCallback.js +++ b/web/src/auth/AuthCallback.js @@ -106,6 +106,7 @@ class AuthCallback extends React.Component { method: method, }; const oAuthParams = Util.getOAuthGetParameters(innerParams); + const concatChar = oAuthParams.redirectUri.indexOf('?') === -1 ? '?' : '&'; AuthBackend.login(body, oAuthParams) .then((res) => { if (res.status === 'ok') { @@ -118,11 +119,11 @@ class AuthCallback extends React.Component { Setting.goToLink(link); } else if (responseType === "code") { const code = res.data; - Setting.goToLink(`${oAuthParams.redirectUri}?code=${code}&state=${oAuthParams.state}`); + Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}code=${code}&state=${oAuthParams.state}`); // Util.showMessage("success", `Authorization code: ${res.data}`); } else if (responseType === "token" || responseType === "id_token"){ const token = res.data; - Setting.goToLink(`${oAuthParams.redirectUri}?${responseType}=${token}&state=${oAuthParams.state}&token_type=bearer`); + Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}${responseType}=${token}&state=${oAuthParams.state}&token_type=bearer`); } else if (responseType === "link") { const from = innerParams.get("from"); Setting.goToLinkSoft(this, from); diff --git a/web/src/auth/LoginPage.js b/web/src/auth/LoginPage.js index ed3fc69a..0333b832 100644 --- a/web/src/auth/LoginPage.js +++ b/web/src/auth/LoginPage.js @@ -138,6 +138,7 @@ class LoginPage extends React.Component { Setting.goToLink(link); } else if (responseType === "code") { const code = res.data; + const concatChar = oAuthParams.redirectUri.indexOf('?') === -1 ? '?' : '&'; if (Setting.hasPromptPage(application)) { AuthBackend.getAccount("") @@ -150,7 +151,7 @@ class LoginPage extends React.Component { this.onUpdateAccount(account); if (Setting.isPromptAnswered(account, application)) { - Setting.goToLink(`${oAuthParams.redirectUri}?code=${code}&state=${oAuthParams.state}`); + Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}code=${code}&state=${oAuthParams.state}`); } else { Setting.goToLinkSoft(ths, `/prompt/${application.name}?redirectUri=${oAuthParams.redirectUri}&code=${code}&state=${oAuthParams.state}`); } @@ -159,7 +160,7 @@ class LoginPage extends React.Component { } }); } else { - Setting.goToLink(`${oAuthParams.redirectUri}?code=${code}&state=${oAuthParams.state}`); + Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}code=${code}&state=${oAuthParams.state}`); } // Util.showMessage("success", `Authorization code: ${res.data}`);