@capgo/capacitor-social-login 8.3.15 → 8.3.17
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 +5 -1
- package/android/src/main/java/ee/forgr/capacitor/social/login/GoogleProvider.java +4 -1
- package/android/src/main/java/ee/forgr/capacitor/social/login/SocialLoginPlugin.java +1 -1
- package/dist/docs.json +2 -2
- package/dist/esm/definitions.d.ts +10 -2
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/google-provider.js +6 -2
- package/dist/esm/google-provider.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/social-login.d.ts +64 -1
- package/dist/esm/social-login.js +63 -1
- package/dist/esm/social-login.js.map +1 -1
- package/dist/plugin.cjs.js +71 -4
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +71 -4
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/SocialLoginPlugin/GoogleProvider.swift +6 -0
- package/ios/Sources/SocialLoginPlugin/SocialLoginPlugin.swift +1 -1
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -1,9 +1,71 @@
|
|
|
1
1
|
var capacitorCapacitorUpdater = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const GOOGLE_OFFLINE_REFRESH_MESSAGE$1 = "Google refresh() is not available when using offline mode. Offline mode only returns serverAuthCode for backend token exchange. Send serverAuthCode to your backend and refresh tokens there, or switch google.mode to 'online' for client-side refresh.";
|
|
5
|
+
const rawSocialLogin = core.registerPlugin('SocialLogin', {
|
|
5
6
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.SocialLoginWeb()),
|
|
6
7
|
});
|
|
8
|
+
class SocialLoginClient {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.initialize = this.initialize.bind(this);
|
|
11
|
+
this.refresh = this.refresh.bind(this);
|
|
12
|
+
}
|
|
13
|
+
async initialize(options) {
|
|
14
|
+
await rawSocialLogin.initialize(options);
|
|
15
|
+
this.initializeOptions = options;
|
|
16
|
+
}
|
|
17
|
+
async login(options) {
|
|
18
|
+
return rawSocialLogin.login(options);
|
|
19
|
+
}
|
|
20
|
+
async logout(options) {
|
|
21
|
+
return rawSocialLogin.logout(options);
|
|
22
|
+
}
|
|
23
|
+
async isLoggedIn(options) {
|
|
24
|
+
return rawSocialLogin.isLoggedIn(options);
|
|
25
|
+
}
|
|
26
|
+
async getAuthorizationCode(options) {
|
|
27
|
+
return rawSocialLogin.getAuthorizationCode(options);
|
|
28
|
+
}
|
|
29
|
+
async refresh(options) {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
if (options.provider === 'google' && ((_b = (_a = this.initializeOptions) === null || _a === void 0 ? void 0 : _a.google) === null || _b === void 0 ? void 0 : _b.mode) === 'offline') {
|
|
32
|
+
console.warn(`[SocialLogin] ${GOOGLE_OFFLINE_REFRESH_MESSAGE$1}`);
|
|
33
|
+
}
|
|
34
|
+
return rawSocialLogin.refresh(options);
|
|
35
|
+
}
|
|
36
|
+
async refreshToken(options) {
|
|
37
|
+
return rawSocialLogin.refreshToken(options);
|
|
38
|
+
}
|
|
39
|
+
async handleRedirectCallback() {
|
|
40
|
+
return rawSocialLogin.handleRedirectCallback();
|
|
41
|
+
}
|
|
42
|
+
async decodeIdToken(options) {
|
|
43
|
+
return rawSocialLogin.decodeIdToken(options);
|
|
44
|
+
}
|
|
45
|
+
async getAccessTokenExpirationDate(options) {
|
|
46
|
+
return rawSocialLogin.getAccessTokenExpirationDate(options);
|
|
47
|
+
}
|
|
48
|
+
async isAccessTokenAvailable(options) {
|
|
49
|
+
return rawSocialLogin.isAccessTokenAvailable(options);
|
|
50
|
+
}
|
|
51
|
+
async isAccessTokenExpired(options) {
|
|
52
|
+
return rawSocialLogin.isAccessTokenExpired(options);
|
|
53
|
+
}
|
|
54
|
+
async isRefreshTokenAvailable(options) {
|
|
55
|
+
return rawSocialLogin.isRefreshTokenAvailable(options);
|
|
56
|
+
}
|
|
57
|
+
async providerSpecificCall(options) {
|
|
58
|
+
return rawSocialLogin.providerSpecificCall(options);
|
|
59
|
+
}
|
|
60
|
+
async getPluginVersion() {
|
|
61
|
+
return rawSocialLogin.getPluginVersion();
|
|
62
|
+
}
|
|
63
|
+
async openSecureWindow(options) {
|
|
64
|
+
return rawSocialLogin.openSecureWindow(options);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const SocialLoginBase = rawSocialLogin;
|
|
68
|
+
const SocialLogin = new SocialLoginClient();
|
|
7
69
|
|
|
8
70
|
/******************************************************************************
|
|
9
71
|
Copyright (c) Microsoft Corporation.
|
|
@@ -468,6 +530,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
468
530
|
}
|
|
469
531
|
}
|
|
470
532
|
|
|
533
|
+
const GOOGLE_OFFLINE_REFRESH_MESSAGE = "Google refresh() is not available when using offline mode. Offline mode only returns serverAuthCode for backend token exchange. Send serverAuthCode to your backend and refresh tokens there, or switch google.mode to 'online' for client-side refresh.";
|
|
471
534
|
class GoogleSocialLogin extends BaseSocialLogin {
|
|
472
535
|
constructor() {
|
|
473
536
|
super(...arguments);
|
|
@@ -584,8 +647,11 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
584
647
|
}
|
|
585
648
|
}
|
|
586
649
|
async refresh() {
|
|
587
|
-
|
|
588
|
-
|
|
650
|
+
if (this.loginType === 'offline') {
|
|
651
|
+
console.warn(`[SocialLogin] ${GOOGLE_OFFLINE_REFRESH_MESSAGE}`);
|
|
652
|
+
return Promise.reject(new Error(GOOGLE_OFFLINE_REFRESH_MESSAGE));
|
|
653
|
+
}
|
|
654
|
+
return Promise.reject(new Error('Google refresh is not implemented on web. Use login() again to obtain a new token.'));
|
|
589
655
|
}
|
|
590
656
|
handleOAuthRedirect(url) {
|
|
591
657
|
const paramsRaw = url.searchParams;
|
|
@@ -2257,8 +2323,9 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
2257
2323
|
SocialLoginWeb: SocialLoginWeb
|
|
2258
2324
|
});
|
|
2259
2325
|
|
|
2260
|
-
exports.SocialLogin =
|
|
2326
|
+
exports.SocialLogin = SocialLogin;
|
|
2261
2327
|
exports.SocialLoginAuthConnect = SocialLoginAuthConnect;
|
|
2328
|
+
exports.SocialLoginBase = SocialLoginBase;
|
|
2262
2329
|
exports.createAuthConnectClient = createAuthConnectClient;
|
|
2263
2330
|
|
|
2264
2331
|
return exports;
|