diff --git a/web/src/App.js b/web/src/App.js index b43c6edd..1583ef71 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -290,7 +290,7 @@ class App extends Component { this.renderHomeIfLoggedIn()}/> - + this.renderLoginIfNotLoggedIn()}/> this.renderLoginIfNotLoggedIn()}/> this.renderLoginIfNotLoggedIn()}/> diff --git a/web/src/auth/AuthCallback.js b/web/src/auth/AuthCallback.js index 09b99d83..1f4f9cd2 100644 --- a/web/src/auth/AuthCallback.js +++ b/web/src/auth/AuthCallback.js @@ -24,9 +24,6 @@ class AuthCallback extends React.Component { super(props); this.state = { classes: props, - applicationName: props.match.params.applicationName, - providerName: props.match.params.providerName, - method: props.match.params.method, }; } @@ -57,15 +54,18 @@ class AuthCallback extends React.Component { componentWillMount() { const params = new URLSearchParams(this.props.location.search); const innerParams = this.getInnerParams(); - let redirectUri = `${window.location.origin}/callback/${this.state.applicationName}/${this.state.providerName}/${this.state.method}`; + const applicationName = innerParams.get("application"); + const providerName = innerParams.get("provider"); + const method = innerParams.get("method"); + let redirectUri = `${window.location.origin}/callback`; const body = { type: this.getResponseType(), - application: this.state.applicationName, - provider: this.state.providerName, + application: applicationName, + provider: providerName, code: params.get("code"), state: innerParams.get("state"), redirectUri: redirectUri, - method: this.state.method, + method: method, }; const oAuthParams = Util.getOAuthGetParameters(innerParams); AuthBackend.login(body, oAuthParams) diff --git a/web/src/auth/Provider.js b/web/src/auth/Provider.js index 49775f07..d76ad78e 100644 --- a/web/src/auth/Provider.js +++ b/web/src/auth/Provider.js @@ -43,8 +43,8 @@ export function getAuthLogo(provider) { } export function getAuthUrl(application, provider, method) { - const redirectUri = `${window.location.origin}/callback/${application.name}/${provider.name}/${method}`; - const state = Util.getQueryParamsToState(); + const redirectUri = `${window.location.origin}/callback`; + const state = Util.getQueryParamsToState(application.name, provider.name, method); if (provider.type === "google") { return `${GoogleAuthUri}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${GoogleAuthScope}&response_type=code&state=${state}`; } else if (provider.type === "github") { diff --git a/web/src/auth/Util.js b/web/src/auth/Util.js index ad7f6c79..c8c87ad1 100644 --- a/web/src/auth/Util.js +++ b/web/src/auth/Util.js @@ -63,8 +63,9 @@ export function getOAuthGetParameters(params) { } } -export function getQueryParamsToState() { - const query = window.location.search; +export function getQueryParamsToState(applicationName, providerName, method) { + let query = window.location.search; + query = `${query}&application=${applicationName}&provider=${providerName}&method=${method}`; return btoa(query); }