From ae758af800ad099b6435cfbcda9b019f4965b239 Mon Sep 17 00:00:00 2001 From: Michael Oberwasserlechner Date: Thu, 27 Aug 2020 12:49:15 +0200 Subject: [PATCH] Allow app to be hosted on same server as provider (#94) --- CHANGELOG.md | 14 +++++++++----- src/web.ts | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be23464b..b69e881c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,17 +3,21 @@ ## [Unreleased] -## [2.1.0] - 2020-08-28 +## [2.1.0] - 2020-08-27 ### Added -* Sign in with Apple. closes #45. -The plugin will detect that the iOS 13+ buildin UI is needed, when `authorizationBaseUrl` contains `https://appleid.apple.com/auth/authorize`. -This is needed for other platforms and iOS <=12 anyway, although other platforms are not yet supported. +* ios: Sign in with Apple. Closes [#45](https://github.com/moberwasserlechner/capacitor-oauth2/issues/45). +The plugin will detect that the iOS 13+ buildin UI is needed, when `authorizationBaseUrl` contains `appleid.apple.com`. +This is needed for other platforms and iOS <=12 anyway. Android, web, iOS <12 are not supported in this release. + +### Fixed + +* web: Make web flow work if server and client are hosted on same server. Closes [#94](https://github.com/moberwasserlechner/capacitor-oauth2/issues/94). thx [@klot-git](https://github.com/klot-git) ### Changed -* iOS: Upgrade SwiftOAuth2 to head +* iOS: Upgrade SwiftOAuth2 to head. Closes [#105](https://github.com/moberwasserlechner/capacitor-oauth2/issues/105) ## [2.0.0] - 2020-04-20 diff --git a/src/web.ts b/src/web.ts index f482eadd..3c725763 100644 --- a/src/web.ts +++ b/src/web.ts @@ -54,7 +54,7 @@ export class OAuth2ClientPluginWeb extends WebPlugin implements OAuth2ClientPlug if (loopCount-- < 0) { this.closeWindow(); } else if (this.windowHandle.closed && !this.windowClosedByPlugin) { - clearInterval(this.intervalId); + window.clearInterval(this.intervalId); reject(new Error("USER_CANCELLED")); } else { let href: string; @@ -64,7 +64,7 @@ export class OAuth2ClientPluginWeb extends WebPlugin implements OAuth2ClientPlug // ignore DOMException: Blocked a frame with origin "http://localhost:4200" from accessing a cross-origin frame. } - if (href != null) { + if (href != null && href.indexOf(this.webOptions.redirectUrl) >= 0) { let urlParamObj = WebUtils.getUrlParams(href); if (urlParamObj) { window.clearInterval(this.intervalId);