From 602bb30730af6a13912a904c8f7742aa15b97b52 Mon Sep 17 00:00:00 2001 From: alexis1987 Date: Sat, 8 Apr 2023 18:04:04 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20base=5Furl=20can=20now=20have=20line=20s?= =?UTF-8?q?egments=20as=20described=20in=20decaporg/dec=E2=80=A6=20(#686)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: alexis1987 --- packages/core/src/lib/auth/netlify-auth.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/src/lib/auth/netlify-auth.ts b/packages/core/src/lib/auth/netlify-auth.ts index 7ae5d6b2..758c4813 100644 --- a/packages/core/src/lib/auth/netlify-auth.ts +++ b/packages/core/src/lib/auth/netlify-auth.ts @@ -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; }