diff --git a/src/components/auth/actions.js b/src/components/auth/actions.js index 44c7175..979c46a 100644 --- a/src/components/auth/actions.js +++ b/src/components/auth/actions.js @@ -192,7 +192,9 @@ export function oAuthComplete(params = {}) { } }) .then((resp) => { - if (resp.redirectUri === 'static_page' || resp.redirectUri === 'static_page_with_code') { + if (resp.redirectUri.startsWith('static_page')) { + resp.code = resp.redirectUri.match(/code=(.+)&/)[1]; + resp.redirectUri = resp.redirectUri.match(/^(.+)\?/)[1]; resp.displayCode = resp.redirectUri === 'static_page_with_code'; dispatch(setOAuthCode({ success: resp.success, diff --git a/src/services/authFlow/CompleteState.js b/src/services/authFlow/CompleteState.js index 273df5d..f6f83a7 100644 --- a/src/services/authFlow/CompleteState.js +++ b/src/services/authFlow/CompleteState.js @@ -33,14 +33,10 @@ export default class CompleteState extends AbstractState { data.accept = this.isPermissionsAccepted; } context.run('oAuthComplete', data).then((resp) => { - switch (resp.redirectUri) { - case 'static_page': - case 'static_page_with_code': - context.setState(new FinishState()); - break; - default: - location.href = resp.redirectUri; - break; + if (resp.redirectUri.startsWith('static_page')) { + context.setState(new FinishState()); + } else { + location.href = resp.redirectUri; } }, (resp) => { // TODO