Merge pull request #950 from Automattic/fix-sso-query-params

Fix SSO query params
This commit is contained in:
R Midhun Suresh 2023-06-20 19:31:38 +05:30 committed by GitHub
commit b42e497258
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,12 +149,15 @@ export class URLRouter<T extends {session: string | boolean}> implements IURLRou
}
createSSOCallbackURL(): string {
return window.location.origin;
return window.location.href;
}
normalizeUrl(): void {
// Remove any queryParameters from the URL
// Gets rid of the loginToken after SSO
this._history.replaceUrlSilently(`${window.location.origin}/${window.location.hash}`);
const url = new URL(window.location.href);
// Remove the loginToken query parameter from the URL after SSO.
url.searchParams.delete("loginToken");
this._history.replaceUrlSilently(url.toString());
}
}