capacitor-auth-manager 3.0.0 → 3.1.0
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/AI-INTEGRATION-GUIDE.md +3 -1
- package/CHANGELOG.md +24 -0
- package/README.md +14 -10
- package/android/build.gradle +6 -0
- package/android/consumer-rules.pro +12 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/ActivityLauncher.java +26 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManager.java +8 -2
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManagerPlugin.java +49 -14
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleAuthProvider.java +192 -471
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleCredentialManagerSignIn.java +175 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleLegacySignIn.java +133 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleProfileCallback.java +8 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleResultMapper.java +158 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/ProviderFactory.java +6 -3
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/SigningDiagnostics.java +76 -0
- package/dist/esm/definitions.d.ts +9 -6
- package/package.json +3 -3
package/AI-INTEGRATION-GUIDE.md
CHANGED
|
@@ -135,7 +135,9 @@ For authenticated backend requests, get a **Firebase** ID token from `firebaseAu
|
|
|
135
135
|
`auth.getIdToken({forceRefresh: true})` can prompt again. A popup-only web session has no Google ID token.
|
|
136
136
|
Use Firebase for background app-session refresh; avoid calling Google interactive refresh on a timer.
|
|
137
137
|
`auth.signOut()` clears the package's local session; also sign out Firebase as shown above.
|
|
138
|
-
Android `revokeAccess()` clears local
|
|
138
|
+
Android `revokeAccess()` clears local, GoogleSignIn and Credential Manager state, not Google's server-side grant.
|
|
139
|
+
|
|
140
|
+
Android sign-in (`androidFlow`, since 3.1.0): `'auto'` runs GoogleSignIn (the path `@codetrix-studio/capacitor-google-auth` used) and falls back to Credential Manager on any failure except a cancel. A configuration error names the installed package and signing SHA-1 — register that SHA-1 on the app's Android OAuth client. Never force `play-services-auth` 22 (it removed GoogleSignIn).
|
|
139
141
|
Account linking, account deletion, and profile updates in Firebase belong to Firebase's API.
|
|
140
142
|
|
|
141
143
|
Default JS storage persists profile metadata, never token strings. Android credentials are kept in process memory;
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,30 @@ All notable changes to `capacitor-auth-manager` are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.1.0] — 2026-10-29
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **Android Google sign-in failed on Play-installed builds with no account picker.** 3.0.0 ran Credential
|
|
13
|
+
Manager alone, which refused the request before showing any UI, while the same OAuth clients and SHA-1s
|
|
14
|
+
worked through GoogleSignIn in the apps' previous releases. The default `androidFlow: 'auto'` now runs
|
|
15
|
+
GoogleSignIn first — the exact path `@codetrix-studio/capacitor-google-auth` used, with the result
|
|
16
|
+
delivered through Capacitor's `@ActivityCallback` — and falls back to Credential Manager on any failure
|
|
17
|
+
except a cancel.
|
|
18
|
+
- **Android errors no longer hide Google's own cause.** Every rejection carries Google's exception class and
|
|
19
|
+
message (`[28444] …`, status codes); configuration errors add the installed package and signing SHA-1.
|
|
20
|
+
- **R8 keep rules now reach consuming apps.** They lived in `proguard-rules.pro`, which only applies to the
|
|
21
|
+
library's own unminified build; they are now in `consumer-rules.pro`.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- `androidFlow` values `'legacy'` (GoogleSignIn only) and `'credential-manager'` (the 3.0.0 behaviour).
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Android depends on `com.google.android.gms:play-services-auth` **21.6.0**, pinned because 22.0.0 removed
|
|
30
|
+
GoogleSignIn. `googleid` stays on 1.1.1 (see `docs/PACKAGES.md`).
|
|
31
|
+
|
|
8
32
|
## [3.0.0] — 2026-10-09
|
|
9
33
|
|
|
10
34
|
### Breaking changes
|
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ code path with a different result shape. The branch then leaks into your UI, you
|
|
|
76
76
|
handling.
|
|
77
77
|
|
|
78
78
|
This package collapses that into `auth.signIn(AuthProvider.GOOGLE)`. It routes to Google Identity Services on
|
|
79
|
-
the web, the GoogleSignIn SDK on iOS and Credential Manager on Android, and returns the same
|
|
79
|
+
the web, the GoogleSignIn SDK on iOS and GoogleSignIn with a Credential Manager fallback on Android, and returns the same
|
|
80
80
|
`{ user, credential }` shape from all three. What you do with the returned credential afterwards — hand it to Firebase,
|
|
81
81
|
or verify it on your own server — stays your decision.
|
|
82
82
|
|
|
@@ -97,7 +97,7 @@ Firebase-popup web flow that works and no native build to support.
|
|
|
97
97
|
|
|
98
98
|
- **One call per platform** — the same `signIn` on web, iOS and Android, returning the same shape.
|
|
99
99
|
- **Firebase-agnostic** — returns Google credentials, and pulls no `firebase` package into your tree.
|
|
100
|
-
- **
|
|
100
|
+
- **Proven native SDKs** — GoogleSignIn on iOS and Android (the same Android path `@codetrix-studio/capacitor-google-auth` used), with Android Credential Manager as the automatic fallback.
|
|
101
101
|
- **Typed framework adapters** — a `useAuth` hook for React, composables for Vue, an injectable
|
|
102
102
|
`AuthService` and route guards for Angular.
|
|
103
103
|
- **Observable auth state** — subscribe once with `onAuthStateChange` and let the UI follow.
|
|
@@ -111,7 +111,7 @@ Firebase-popup web flow that works and no native build to support.
|
|
|
111
111
|
| Platform | Supported | Notes |
|
|
112
112
|
|---|---|---|
|
|
113
113
|
| Web | ✅ | Google Identity Services. One-Tap / FedCM returns an `idToken`; the OAuth2 popup fallback returns an `accessToken` (`webFlow`). |
|
|
114
|
-
| Android | ✅ | Credential Manager bottom sheet,
|
|
114
|
+
| Android | ✅ | GoogleSignIn account chooser, falling back to Credential Manager (bottom sheet, then the Sign in with Google button) — `androidFlow`. `serverClientId` is required to receive an `idToken`. |
|
|
115
115
|
| iOS | ✅ | GoogleSignIn 10.x; iOS 15+. Returns `idToken`, `accessToken`, and `serverAuthCode` when configured. |
|
|
116
116
|
| Node / SSR | ✅ import | Importing is side-effect free since `3.0.0`; sign-in itself still needs a browser or a device. |
|
|
117
117
|
|
|
@@ -150,8 +150,9 @@ yarn cap sync
|
|
|
150
150
|
Then finish the per-platform OAuth setup, which cannot be done from JavaScript:
|
|
151
151
|
|
|
152
152
|
- **Android** — register the app's SHA-1 and SHA-256 fingerprints against an
|
|
153
|
-
Android OAuth client, and pass your **Web** client ID as `serverClientId
|
|
154
|
-
|
|
153
|
+
Android OAuth client, and pass your **Web** client ID as `serverClientId`; Google returns no `idToken`
|
|
154
|
+
without it. Register **every** signing key: the debug key, the upload key (locally signed APKs) and the
|
|
155
|
+
**Play App Signing** key (every Play-installed copy is re-signed with it). The plugin declares only `INTERNET`, without SMS or biometric permissions. It does not require a Firebase native SDK or `google-services.json` of its own.
|
|
155
156
|
- **iOS** — add `GIDClientID` to `Info.plist` (or pass `iosClientId`), and add the reversed client ID as a URL
|
|
156
157
|
scheme under `CFBundleURLTypes`.
|
|
157
158
|
|
|
@@ -276,7 +277,7 @@ Google provider options:
|
|
|
276
277
|
| Option | Platform | What it does |
|
|
277
278
|
|---|---|---|
|
|
278
279
|
| `clientId` | web (required), Android fallback | Web OAuth client ID; becomes the id token's `aud`. |
|
|
279
|
-
| `serverClientId` | Android (required), iOS | Web OAuth client ID.
|
|
280
|
+
| `serverClientId` | Android (required), iOS | Web OAuth client ID. Google needs it to return an `idToken`. |
|
|
280
281
|
| `iosClientId` | iOS | iOS OAuth client ID, if not set as `GIDClientID` in `Info.plist`. |
|
|
281
282
|
| `scopes` | all | Extra OAuth scopes. Defaults to `openid email profile`. |
|
|
282
283
|
| `hostedDomain` | all | Restrict sign-in to one Google Workspace domain. |
|
|
@@ -285,7 +286,7 @@ Google provider options:
|
|
|
285
286
|
| `autoSelectEnabled` | Android | Allow one-tap auto-select for returning users. |
|
|
286
287
|
| `nonce` | web | Bind the request to an id-token `nonce` claim, which the package validates. |
|
|
287
288
|
| `webFlow` | web | `'auto'` (default: One-Tap, then the OAuth2 popup if One-Tap is not shown) · `'one-tap'` · `'popup'`. Also accepted per call in `signIn({ options })`. |
|
|
288
|
-
| `androidFlow` | Android | `'auto'` (default:
|
|
289
|
+
| `androidFlow` | Android | `'auto'` (default: GoogleSignIn, then Credential Manager if it fails for any reason other than a cancel) · `'legacy'` · `'credential-manager'` · `'bottom-sheet'` · `'button'`. Also accepted per call. |
|
|
289
290
|
|
|
290
291
|
The same Google options can live in `capacitor.config` under the plugin block instead of in application code.
|
|
291
292
|
Full reference: [Configuration](https://capacitor-auth-manager-docs.aoneahsan.com/getting-started/configuration).
|
|
@@ -399,7 +400,8 @@ It asks for Web/iOS OAuth client IDs and creates `capacitor-auth.config.json` pl
|
|
|
399
400
|
| `Cannot find module '…/core/auth-manager'` under Node | you are on `< 3.0.0` | Upgrade — every relative specifier carries its `.js` extension since `3.0.0` |
|
|
400
401
|
| `POPUP_BLOCKED` on web with `webFlow: 'one-tap'` | One-Tap is suppressed (cooldown, FedCM opt-out, third-party cookies) | Use the default `webFlow: 'auto'` (falls back to the popup) or `'popup'`, or draw Google's button with `GoogleAuthProviderWeb.renderButton` — see [Advanced Features](#advanced-features) |
|
|
401
402
|
| `USER_CANCELLED` / `POPUP_CLOSED_BY_USER` | the user closed One-Tap or the popup | Expected — show your own "try again" |
|
|
402
|
-
|
|
|
403
|
+
| Android error names `signing SHA-1=…` | Google has no Android OAuth client for that package + certificate | Register that exact SHA-1 for the app (a Play-installed build reports the Play App Signing key). No new build is needed |
|
|
404
|
+
| Play builds fail with no account picker on `3.0.0` | Credential Manager refused the request (on Android 14+ it depends on the device's credential-provider settings) | Upgrade to `3.1.0`: the default flow uses GoogleSignIn first |
|
|
403
405
|
| `Cannot find module '@capacitor/core'` | the peer is not installed | `yarn add @capacitor/core` — it is a required peer |
|
|
404
406
|
| Native plugin never runs | `yarn cap sync` was not run after install | Run it, then rebuild the native project |
|
|
405
407
|
|
|
@@ -414,8 +416,10 @@ Stated as plainly as the features, because each one otherwise costs an afternoon
|
|
|
414
416
|
- **Web returns one token per flow.** One-Tap yields an `idToken` and no `accessToken`; the OAuth2 popup
|
|
415
417
|
yields an `accessToken` and no `idToken`. Firebase accepts either
|
|
416
418
|
(`GoogleAuthProvider.credential(idToken ?? null, accessToken)`); an ID-token-only backend must explicitly select One-Tap and reject a missing ID token.
|
|
417
|
-
- **Android returns an `idToken` only.** Access tokens
|
|
418
|
-
|
|
419
|
+
- **Android returns an `idToken` only.** Access tokens come from the separate Google Authorization API.
|
|
420
|
+
Only iOS returns everything.
|
|
421
|
+
- **Android GoogleSignIn is deprecated by Google** and was removed in `play-services-auth` 22, so the
|
|
422
|
+
package pins 21.x. Do not force `play-services-auth` 22 in your app, or `'auto'` falls through to Credential Manager.
|
|
419
423
|
- **No id-token verification in the browser.** Signature and claim checks belong to your server, or Firebase.
|
|
420
424
|
- **Native runtime is not covered by CI.** Both platforms are verified to compile, not to sign in. Test a new
|
|
421
425
|
version on one real device before rolling it out widely.
|
package/android/build.gradle
CHANGED
|
@@ -55,6 +55,12 @@ dependencies {
|
|
|
55
55
|
implementation 'androidx.credentials:credentials-play-services-auth:1.6.0'
|
|
56
56
|
implementation 'com.google.android.libraries.identity.googleid:googleid:1.1.1'
|
|
57
57
|
|
|
58
|
+
// Legacy GoogleSignIn: the automatic fallback when Credential Manager refuses a request (the API
|
|
59
|
+
// @codetrix-studio/capacitor-google-auth used). Pinned to 21.x: play-services-auth 22.0.0 REMOVED
|
|
60
|
+
// com.google.android.gms.auth.api.signin.* (verified 2026-10-29 by listing both AARs' classes).
|
|
61
|
+
// Re-check when Google ships a 22.x replacement for silent ID-token sign-in, then drop the fallback.
|
|
62
|
+
implementation 'com.google.android.gms:play-services-auth:21.6.0'
|
|
63
|
+
|
|
58
64
|
// NOTE: Google-first build (2.4.x). The Facebook SDK + Microsoft MSAL dependencies were removed so
|
|
59
65
|
// this plugin no longer pulls heavy auth SDKs into every consumer app. Their native providers live in
|
|
60
66
|
// android/disabled-native-providers/ (not compiled, not shipped). Re-add a dependency here when its
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
+
# Shipped into every consuming app's R8 run (consumerProguardFiles). android/proguard-rules.pro only
|
|
2
|
+
# applies to this library's own unminified build, so any rule a release app needs must live here.
|
|
3
|
+
|
|
1
4
|
# Capacitor discovers plugin entry points and invokes methods by reflection.
|
|
2
5
|
-keep @com.getcapacitor.annotation.CapacitorPlugin class * { *; }
|
|
6
|
+
-keep class com.aoneahsan.capacitor_auth_manager.** { *; }
|
|
7
|
+
|
|
8
|
+
# Credential Manager finds its Play Services provider by class name from the merged manifest.
|
|
9
|
+
-keep class androidx.credentials.playservices.** { *; }
|
|
10
|
+
-keep class com.google.android.libraries.identity.googleid.** { *; }
|
|
11
|
+
|
|
12
|
+
# Legacy GoogleSignIn fallback (play-services-auth 21.x).
|
|
13
|
+
-keep class com.google.android.gms.auth.api.signin.** { *; }
|
|
14
|
+
-keep class com.google.android.gms.common.api.ApiException { *; }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package com.aoneahsan.capacitor_auth_manager;
|
|
2
|
+
|
|
3
|
+
import android.content.Intent;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Starts an Activity for a result on behalf of a provider and hands the result back.
|
|
7
|
+
*
|
|
8
|
+
* <p>Implemented by {@link CapacitorAuthManagerPlugin} through Capacitor's
|
|
9
|
+
* {@code startActivityForResult(call, intent, callbackName)} + {@code @ActivityCallback}, which is
|
|
10
|
+
* the piece the 2.x GoogleSignIn flow lacked: it called {@code startActivityForResult} on the
|
|
11
|
+
* Activity directly, the result never reached the plugin, and sign-in hung.</p>
|
|
12
|
+
*/
|
|
13
|
+
public interface ActivityLauncher {
|
|
14
|
+
|
|
15
|
+
/** Receives the finished Activity's result code and data (data may be {@code null}). */
|
|
16
|
+
interface ResultHandler {
|
|
17
|
+
void onResult(int resultCode, Intent data);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Launch {@code intent} for the plugin call currently in flight.
|
|
22
|
+
*
|
|
23
|
+
* @return {@code false} when no plugin call is in flight to attach the result to.
|
|
24
|
+
*/
|
|
25
|
+
boolean launch(Intent intent, ResultHandler handler);
|
|
26
|
+
}
|
package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManager.java
CHANGED
|
@@ -21,6 +21,7 @@ public class CapacitorAuthManager {
|
|
|
21
21
|
private final Map<String, AuthStateListener> authStateListeners;
|
|
22
22
|
private String currentProvider;
|
|
23
23
|
private boolean isInitialized;
|
|
24
|
+
private ActivityLauncher activityLauncher;
|
|
24
25
|
|
|
25
26
|
public CapacitorAuthManager(Context context, Activity activity) {
|
|
26
27
|
this.context = context;
|
|
@@ -32,6 +33,11 @@ public class CapacitorAuthManager {
|
|
|
32
33
|
this.isInitialized = false;
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
/** Lets providers start an Activity for a result through the plugin (legacy GoogleSignIn). */
|
|
37
|
+
public void setActivityLauncher(ActivityLauncher activityLauncher) {
|
|
38
|
+
this.activityLauncher = activityLauncher;
|
|
39
|
+
}
|
|
40
|
+
|
|
35
41
|
public void initialize(JSObject options, AuthCallback<Void> callback) {
|
|
36
42
|
if (isInitialized) {
|
|
37
43
|
logger.warn("Auth manager already initialized");
|
|
@@ -108,7 +114,7 @@ public class CapacitorAuthManager {
|
|
|
108
114
|
private void registerProviderFromConfig(String providerName, JSObject configObj) {
|
|
109
115
|
try {
|
|
110
116
|
BaseAuthProvider provider = ProviderFactory.createProvider(
|
|
111
|
-
providerName, context, activity, storage, logger, configObj);
|
|
117
|
+
providerName, context, activity, storage, logger, configObj, activityLauncher);
|
|
112
118
|
if (provider != null) {
|
|
113
119
|
providers.put(providerName, provider);
|
|
114
120
|
logger.info("Registered provider: " + providerName);
|
|
@@ -307,7 +313,7 @@ public class CapacitorAuthManager {
|
|
|
307
313
|
|
|
308
314
|
try {
|
|
309
315
|
BaseAuthProvider authProvider = ProviderFactory.createProvider(
|
|
310
|
-
provider, context, activity, storage, logger, options);
|
|
316
|
+
provider, context, activity, storage, logger, options, activityLauncher);
|
|
311
317
|
|
|
312
318
|
if (authProvider != null) {
|
|
313
319
|
providers.put(provider, authProvider);
|
package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManagerPlugin.java
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
package com.aoneahsan.capacitor_auth_manager;
|
|
2
2
|
|
|
3
|
+
import android.content.Intent;
|
|
4
|
+
|
|
5
|
+
import androidx.activity.result.ActivityResult;
|
|
6
|
+
|
|
3
7
|
import com.getcapacitor.JSObject;
|
|
4
8
|
import com.getcapacitor.Plugin;
|
|
5
9
|
import com.getcapacitor.PluginCall;
|
|
6
10
|
import com.getcapacitor.PluginMethod;
|
|
11
|
+
import com.getcapacitor.annotation.ActivityCallback;
|
|
7
12
|
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
8
13
|
|
|
9
14
|
@CapacitorPlugin(name = "CapacitorAuthManager")
|
|
@@ -11,6 +16,10 @@ public class CapacitorAuthManagerPlugin extends Plugin {
|
|
|
11
16
|
|
|
12
17
|
private CapacitorAuthManager implementation;
|
|
13
18
|
|
|
19
|
+
/** The signIn/linkAccount call in flight; an Activity started for a result attaches to it. */
|
|
20
|
+
private PluginCall activeSignInCall;
|
|
21
|
+
private ActivityLauncher.ResultHandler pendingActivityHandler;
|
|
22
|
+
|
|
14
23
|
/**
|
|
15
24
|
* Reject a call with the {@link AuthErrorCodes} value the failure carries, so JS receives a real
|
|
16
25
|
* {@code AuthError.code} instead of one guessed from the message text. A plain exception (nothing
|
|
@@ -32,6 +41,42 @@ public class CapacitorAuthManagerPlugin extends Plugin {
|
|
|
32
41
|
@Override
|
|
33
42
|
public void load() {
|
|
34
43
|
implementation = new CapacitorAuthManager(getContext(), getActivity());
|
|
44
|
+
implementation.setActivityLauncher(this::launchForResult);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** {@link ActivityLauncher} for providers: Capacitor's result API, delivered to {@link #onProviderActivityResult}. */
|
|
48
|
+
private boolean launchForResult(Intent intent, ActivityLauncher.ResultHandler handler) {
|
|
49
|
+
PluginCall call = activeSignInCall;
|
|
50
|
+
if (call == null) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
pendingActivityHandler = handler;
|
|
54
|
+
startActivityForResult(call, intent, "onProviderActivityResult");
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@ActivityCallback
|
|
59
|
+
private void onProviderActivityResult(PluginCall call, ActivityResult result) {
|
|
60
|
+
ActivityLauncher.ResultHandler handler = pendingActivityHandler;
|
|
61
|
+
pendingActivityHandler = null;
|
|
62
|
+
if (handler != null) {
|
|
63
|
+
handler.onResult(result.getResultCode(), result.getData());
|
|
64
|
+
} else if (call != null) {
|
|
65
|
+
call.reject("Google sign-in result arrived with no pending request", AuthErrorCodes.INTERNAL_ERROR);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Settles a sign-in call and releases it if an Activity result saved it on the bridge. */
|
|
70
|
+
private void settleSignIn(PluginCall call, CapacitorAuthManager.AuthResult<JSObject> result) {
|
|
71
|
+
if (activeSignInCall == call) {
|
|
72
|
+
activeSignInCall = null;
|
|
73
|
+
}
|
|
74
|
+
if (result.isSuccess()) {
|
|
75
|
+
call.resolve(result.getData());
|
|
76
|
+
} else {
|
|
77
|
+
rejectWith(call, result.getError());
|
|
78
|
+
}
|
|
79
|
+
getBridge().releaseCall(call);
|
|
35
80
|
}
|
|
36
81
|
|
|
37
82
|
@PluginMethod
|
|
@@ -73,13 +118,8 @@ public class CapacitorAuthManagerPlugin extends Plugin {
|
|
|
73
118
|
return;
|
|
74
119
|
}
|
|
75
120
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
call.resolve(result.getData());
|
|
79
|
-
} else {
|
|
80
|
-
rejectWith(call, result.getError());
|
|
81
|
-
}
|
|
82
|
-
});
|
|
121
|
+
activeSignInCall = call;
|
|
122
|
+
implementation.signIn(provider, credentials, options, result -> settleSignIn(call, result));
|
|
83
123
|
} catch (Exception e) {
|
|
84
124
|
call.reject("Sign in failed: " + e.getMessage(), AuthException.codeOf(e, AuthErrorCodes.SIGN_IN_FAILED));
|
|
85
125
|
}
|
|
@@ -236,13 +276,8 @@ public class CapacitorAuthManagerPlugin extends Plugin {
|
|
|
236
276
|
return;
|
|
237
277
|
}
|
|
238
278
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
call.resolve(result.getData());
|
|
242
|
-
} else {
|
|
243
|
-
rejectWith(call, result.getError());
|
|
244
|
-
}
|
|
245
|
-
});
|
|
279
|
+
activeSignInCall = call;
|
|
280
|
+
implementation.linkAccount(provider, credentials, options, result -> settleSignIn(call, result));
|
|
246
281
|
} catch (Exception e) {
|
|
247
282
|
call.reject("Account linking failed: " + e.getMessage(), AuthException.codeOf(e, AuthErrorCodes.OPERATION_NOT_ALLOWED));
|
|
248
283
|
}
|