@capgo/capacitor-social-login 8.7.11 → 8.7.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/android/src/main/java/ee/forgr/capacitor/social/login/GoogleHostedDomainRules.java +41 -0
- package/android/src/main/java/ee/forgr/capacitor/social/login/GoogleLoginHostedDomainUiRules.java +52 -0
- package/android/src/main/java/ee/forgr/capacitor/social/login/GoogleProvider.java +108 -13
- package/android/src/main/java/ee/forgr/capacitor/social/login/SocialLoginPlugin.java +15 -1
- package/dist/docs.json +4 -16
- package/dist/esm/definitions.d.ts +41 -8
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/oauth-popup-bridge.js +16 -2
- package/dist/esm/oauth-popup-bridge.js.map +1 -1
- package/dist/esm/oauth2-provider.js +2 -2
- package/dist/esm/oauth2-provider.js.map +1 -1
- package/dist/plugin.cjs.js +18 -4
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +18 -4
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/SocialLoginPlugin/SocialLoginPlugin.swift +1 -1
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -147,10 +147,24 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
147
147
|
return false;
|
|
148
148
|
return !!window.opener || POPUP_WINDOW_NAMES.has(window.name) || !!sessionStorage.getItem(OAUTH_POPUP_SESSION_KEY);
|
|
149
149
|
}
|
|
150
|
+
function isPendingRedirectFlow(stateRaw) {
|
|
151
|
+
var _a;
|
|
152
|
+
try {
|
|
153
|
+
return ((_a = JSON.parse(stateRaw)) === null || _a === void 0 ? void 0 : _a.flow) === 'redirect';
|
|
154
|
+
}
|
|
155
|
+
catch (_b) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
150
159
|
function shouldAutoFinishOAuthRedirect() {
|
|
151
|
-
|
|
160
|
+
const stateRaw = localStorage.getItem(OAUTH_STATE_KEY);
|
|
161
|
+
if (!stateRaw)
|
|
162
|
+
return false;
|
|
163
|
+
// Same-window redirect (flow: 'redirect') must call handleRedirectCallback(), even when the
|
|
164
|
+
// tab has a window.opener (e.g. the app itself was opened by another site via window.open).
|
|
165
|
+
if (isPendingRedirectFlow(stateRaw))
|
|
152
166
|
return false;
|
|
153
|
-
// Popup only.
|
|
167
|
+
// Popup only.
|
|
154
168
|
return isOAuthPopupContext();
|
|
155
169
|
}
|
|
156
170
|
/**
|
|
@@ -879,7 +893,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
879
893
|
}
|
|
880
894
|
}
|
|
881
895
|
async login(options) {
|
|
882
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
896
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
883
897
|
const { providerId } = options;
|
|
884
898
|
const config = this.getProvider(providerId);
|
|
885
899
|
await this.ensureDiscovered(providerId);
|
|
@@ -926,7 +940,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
926
940
|
redirectUri,
|
|
927
941
|
scope,
|
|
928
942
|
});
|
|
929
|
-
localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, JSON.stringify({ provider: 'oauth2', providerId, state }));
|
|
943
|
+
localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, JSON.stringify({ provider: 'oauth2', providerId, state, flow: (_k = options.flow) !== null && _k !== void 0 ? _k : 'popup' }));
|
|
930
944
|
if (!config.authorizationBaseUrl) {
|
|
931
945
|
throw new Error(`OAuth2 provider '${providerId}' is missing authorizationBaseUrl (discovery may have failed).`);
|
|
932
946
|
}
|