fix: base_url can now have line segments as described in decaporg/dec… (#686)

Co-authored-by: alexis1987 <alexis1987@github.com>
This commit is contained in:
alexis1987 2023-04-08 18:04:04 +02:00 committed by GitHub
parent 8df0bf23ed
commit 602bb30730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,10 @@ class Authenticator {
cb: (error: Error | NetlifyError | null, data?: User) => void,
) {
const fn = (e: { data: string; origin: string }) => {
if (e.data === 'authorizing:' + options.provider && e.origin === this.base_url) {
if (
e.data === 'authorizing:' + options.provider &&
e.origin === new URL(this.base_url).origin
) {
window.removeEventListener('message', fn, false);
window.addEventListener('message', this.authorizeCallback(options, cb), false);
return this.authWindow?.postMessage(e.data, e.origin);
@ -50,7 +53,7 @@ class Authenticator {
cb: (error: Error | NetlifyError | null, data?: User) => void,
) {
const fn = (e: { data: string; origin: string }) => {
if (e.origin !== this.base_url) {
if (e.origin !== new URL(this.base_url).origin) {
return;
}