capacitor-auth-manager 2.4.1 → 2.4.2

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/CHANGELOG.md CHANGED
@@ -5,6 +5,37 @@ 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
+ ## [2.4.2] — 2026-06-30
9
+
10
+ **Native now actually compiles — Google-only native (verified).** `2.4.1` shipped native sources that
11
+ had never been built in a real app; an end-to-end integration compile (a throwaway Capacitor app, real
12
+ Android `gradle assembleDebug` + iOS `pod lib lint`) surfaced and fixed the breakage. **Use `2.4.2`, not
13
+ `2.4.1`** (which is deprecated).
14
+
15
+ ### Changed
16
+
17
+ - **Native is Google-only.** Removed the Facebook (`FBSDKLoginKit` / `facebook-login`) and Microsoft
18
+ (`MSAL`) native dependencies so the plugin no longer drags heavy auth SDKs into every consumer app. The
19
+ disabled providers' native code moved to `android/disabled-native-providers/` and
20
+ `ios/disabled-native-providers/` (kept for re-enablement; not compiled, not shipped). `ProviderFactory`
21
+ (Android) and `createProvider` (iOS) are trimmed to Google; the JS layer already reports
22
+ `PROVIDER_NOT_ENABLED` for the rest.
23
+ - iOS podspec slimmed to `Capacitor` + `GoogleSignIn ~> 7.1`; removed the dangling
24
+ `SWIFT_OBJC_BRIDGING_HEADER` (the file never existed; GoogleSignIn 7 is pure Swift).
25
+
26
+ ### Fixed (native compile errors that blocked every consumer build)
27
+
28
+ - **Android:** `com.facebook.android:facebook-login:17.0.3` was unresolvable → build failed before any
29
+ Java compiled. `GoogleAuthProvider` caught `GoogleIdTokenParsingException`, a checked exception
30
+ `GoogleIdTokenCredential.createFrom` doesn't declare in googleid 1.1.1. `getIdToken` called the throwing
31
+ `JSObject.getBoolean(...)` unguarded → unreported `JSONException`. Verified with `gradle :…:assembleDebug`.
32
+ - **iOS:** `CapacitorAuthManager` passed `AuthPersistence` / `AuthProvider` enums where the storage API
33
+ expects `String` (`.rawValue`). `Plugin.removeAllListeners(_:)` now `override public`s Capacitor 8's
34
+ built-in and delegates to `super`. Verified with `pod lib lint`.
35
+
36
+ > Both platforms now build in a clean Capacitor 8 app. Still verify Google sign-in on a real device before
37
+ > the fleet rollout (a successful compile is not a runtime test).
38
+
8
39
  ## [2.4.1] — 2026-06-30
9
40
 
10
41
  **Google-first production refocus.** This release turns the package into a working, **Firebase-agnostic
@@ -14,23 +14,15 @@ Pod::Spec.new do |s|
14
14
  s.ios.deployment_target = '14.0'
15
15
  s.swift_version = '5.9'
16
16
  s.dependency 'Capacitor'
17
-
18
- # Auth Provider Dependencies
17
+
18
+ # Google Sign-In — the only enabled provider as of 2.4.x (Firebase-agnostic). Pure-Swift SDK,
19
+ # no Objective-C bridging header required.
19
20
  s.dependency 'GoogleSignIn', '~> 7.1'
20
- s.dependency 'FBSDKLoginKit', '~> 17.0'
21
-
22
- # Apple Sign In is built into iOS
23
-
24
- # Microsoft Authentication Library
25
- s.dependency 'MSAL', '~> 1.5'
26
-
27
- # Firebase Auth (optional, can be added when needed)
28
- # s.dependency 'Firebase/Auth'
29
-
21
+
22
+ # NOTE: Google-first build. The Facebook (FBSDKLoginKit) and Microsoft (MSAL) pod dependencies were
23
+ # removed so this plugin no longer pulls heavy auth SDKs into every consumer app. Those providers'
24
+ # Swift lives in ios/disabled-native-providers/ (not compiled, not shipped). Re-add a dependency here
25
+ # when its provider is re-enabled.
26
+
30
27
  s.static_framework = true
31
-
32
- # Required for Google Sign In
33
- s.pod_target_xcconfig = {
34
- 'SWIFT_OBJC_BRIDGING_HEADER' => '$(PODS_TARGET_SRCROOT)/ios/Plugin/Plugin-Bridging-Header.h'
35
- }
36
28
  end
@@ -61,22 +61,12 @@ dependencies {
61
61
  implementation 'androidx.credentials:credentials-play-services-auth:1.3.0'
62
62
  implementation 'com.google.android.libraries.identity.googleid:googleid:1.1.1'
63
63
 
64
- // Facebook SDK
65
- implementation 'com.facebook.android:facebook-login:17.0.3'
66
-
67
- // Microsoft Authentication Library (MSAL)
68
- implementation 'com.microsoft.identity.client:msal:5.2.0'
69
-
70
- // Firebase Auth (optional)
71
- // implementation 'com.google.firebase:firebase-auth:23.2.0'
72
-
73
- // Biometric
74
- implementation 'androidx.biometric:biometric:1.1.0'
75
-
76
- // Coroutines for async operations
77
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0'
78
-
79
- // Security
64
+ // NOTE: Google-first build (2.4.x). The Facebook SDK + Microsoft MSAL dependencies were removed so
65
+ // this plugin no longer pulls heavy auth SDKs into every consumer app. Their native providers live in
66
+ // android/disabled-native-providers/ (not compiled, not shipped). Re-add a dependency here when its
67
+ // provider is re-enabled.
68
+
69
+ // Security (AuthStorage uses EncryptedSharedPreferences)
80
70
  implementation 'androidx.security:security-crypto:1.1.0-alpha06'
81
71
 
82
72
  testImplementation "junit:junit:$junitVersion"
@@ -425,7 +425,7 @@ public class CapacitorAuthManager {
425
425
  return;
426
426
  }
427
427
 
428
- boolean forceRefresh = options != null && options.has("forceRefresh") ? options.getBoolean("forceRefresh") : false;
428
+ boolean forceRefresh = options != null && options.optBoolean("forceRefresh", false);
429
429
  authProvider.getIdToken(forceRefresh, callback);
430
430
  }
431
431
 
@@ -22,7 +22,6 @@ import androidx.credentials.exceptions.NoCredentialException;
22
22
  import com.getcapacitor.JSObject;
23
23
  import com.google.android.libraries.identity.googleid.GetGoogleIdOption;
24
24
  import com.google.android.libraries.identity.googleid.GoogleIdTokenCredential;
25
- import com.google.android.libraries.identity.googleid.GoogleIdTokenParsingException;
26
25
 
27
26
  import org.json.JSONArray;
28
27
  import org.json.JSONObject;
@@ -355,11 +354,9 @@ public class GoogleAuthProvider implements BaseAuthProvider {
355
354
  callback.onResult(CapacitorAuthManager.AuthResult.error(new IllegalStateException(
356
355
  "Unexpected credential type returned from Google sign-in: " + type)));
357
356
  }
358
- } catch (GoogleIdTokenParsingException e) {
359
- logger.error("Failed to parse Google ID token credential", e);
360
- callback.onResult(CapacitorAuthManager.AuthResult.error(new Exception(
361
- "Failed to parse Google ID token credential: " + e.getMessage())));
362
357
  } catch (Exception e) {
358
+ // Covers a malformed credential / ID-token parse failure. (googleid 1.1.1's
359
+ // GoogleIdTokenCredential.createFrom does not declare a checked exception.)
363
360
  logger.error("Unexpected error handling Google credential", e);
364
361
  callback.onResult(CapacitorAuthManager.AuthResult.error(e));
365
362
  }
@@ -11,6 +11,13 @@ import org.json.JSONException;
11
11
  import java.util.ArrayList;
12
12
  import java.util.List;
13
13
 
14
+ /**
15
+ * Creates native auth providers. As of 2.4.x the plugin is Google-first: only the Google provider is
16
+ * built. The Facebook / Microsoft native implementations were moved to
17
+ * {@code android/disabled-native-providers/} (out of the compiled source set + not shipped) so the
18
+ * plugin no longer drags the Facebook SDK / MSAL into every consumer app. Re-add a provider's case here
19
+ * (and its dependency in build.gradle, and move its file back) when it is re-enabled.
20
+ */
14
21
  public class ProviderFactory {
15
22
  private static final String TAG = "ProviderFactory";
16
23
 
@@ -31,40 +38,10 @@ public class ProviderFactory {
31
38
  case "google.com":
32
39
  return createGoogleProvider(context, activity, storage, logger, config);
33
40
 
34
- case "facebook":
35
- case "facebook.com":
36
- return createFacebookProvider(context, activity, storage, logger, config);
37
-
38
- case "microsoft":
39
- case "microsoft.com":
40
- return createMicrosoftProvider(context, activity, storage, logger, config);
41
-
42
- case "apple":
43
- case "apple.com":
44
- // Apple Sign-In on Android uses web-based flow
45
- logger.warn("Apple Sign-In requires web-based authentication on Android");
46
- return null;
47
-
48
- case "github":
49
- case "github.com":
50
- // GitHub uses OAuth web flow
51
- logger.info("GitHub authentication uses OAuth web flow");
52
- return null;
53
-
54
- case "slack":
55
- case "slack.com":
56
- // Slack uses OAuth web flow
57
- logger.info("Slack authentication uses OAuth web flow");
58
- return null;
59
-
60
- case "linkedin":
61
- case "linkedin.com":
62
- // LinkedIn uses OAuth web flow
63
- logger.info("LinkedIn authentication uses OAuth web flow");
64
- return null;
65
-
66
41
  default:
67
- logger.warn("Unknown provider type: " + providerType);
42
+ // Every non-Google provider is disabled in the Google-first build. The JS layer already
43
+ // reports AuthErrorCode.PROVIDER_NOT_ENABLED before reaching native; this is a safety net.
44
+ logger.warn("Provider '" + providerType + "' is not enabled yet (Google-only build).");
68
45
  return null;
69
46
  }
70
47
  }
@@ -128,81 +105,4 @@ public class ProviderFactory {
128
105
 
129
106
  return provider;
130
107
  }
131
-
132
- private static FacebookAuthProvider createFacebookProvider(
133
- Context context,
134
- Activity activity,
135
- AuthStorage storage,
136
- AuthLogger logger,
137
- JSObject config
138
- ) {
139
- FacebookAuthProvider provider = new FacebookAuthProvider(context, activity, storage, logger);
140
-
141
- if (config != null) {
142
- String appId = config.getString("appId");
143
- if (appId != null) {
144
- provider.setAppId(appId);
145
- }
146
-
147
- try {
148
- JSONArray permissionsArray = config.getJSONArray("permissions");
149
- if (permissionsArray == null) {
150
- permissionsArray = config.getJSONArray("scopes");
151
- }
152
- if (permissionsArray != null) {
153
- List<String> permissions = new ArrayList<>();
154
- for (int i = 0; i < permissionsArray.length(); i++) {
155
- permissions.add(permissionsArray.getString(i));
156
- }
157
- provider.setPermissions(permissions);
158
- }
159
- } catch (JSONException e) {
160
- // Use default permissions
161
- }
162
- }
163
-
164
- return provider;
165
- }
166
-
167
- private static MicrosoftAuthProvider createMicrosoftProvider(
168
- Context context,
169
- Activity activity,
170
- AuthStorage storage,
171
- AuthLogger logger,
172
- JSObject config
173
- ) {
174
- MicrosoftAuthProvider provider = new MicrosoftAuthProvider(context, activity, storage, logger);
175
-
176
- if (config != null) {
177
- String clientId = config.getString("clientId");
178
- if (clientId != null) {
179
- provider.setClientId(clientId);
180
- }
181
-
182
- String authority = config.getString("authority");
183
- if (authority != null) {
184
- provider.setAuthority(authority);
185
- }
186
-
187
- String redirectUri = config.getString("redirectUri");
188
- if (redirectUri != null) {
189
- provider.setRedirectUri(redirectUri);
190
- }
191
-
192
- try {
193
- JSONArray scopesArray = config.getJSONArray("scopes");
194
- if (scopesArray != null) {
195
- List<String> scopes = new ArrayList<>();
196
- for (int i = 0; i < scopesArray.length(); i++) {
197
- scopes.add(scopesArray.getString(i));
198
- }
199
- provider.setScopes(scopes);
200
- }
201
- } catch (JSONException e) {
202
- // Use default scopes
203
- }
204
- }
205
-
206
- return provider;
207
- }
208
108
  }
@@ -27,7 +27,7 @@ import Capacitor
27
27
  logger.setLogLevel(options.logLevel)
28
28
 
29
29
  // Configure storage persistence
30
- storage.setPersistence(options.persistence)
30
+ storage.setPersistence(options.persistence.rawValue)
31
31
 
32
32
  // Initialize providers
33
33
  let group = DispatchGroup()
@@ -76,7 +76,7 @@ import Capacitor
76
76
  provider.signIn(credentials: options.credentials, options: options.options) { result, error in
77
77
  if let result = result {
78
78
  self.currentProvider = options.provider
79
- self.storage.setLastAuthProvider(options.provider)
79
+ self.storage.setLastAuthProvider(options.provider.rawValue)
80
80
 
81
81
  // Notify listeners
82
82
  self.notifyAuthStateChange(result.user)
@@ -374,7 +374,7 @@ import Capacitor
374
374
  }
375
375
 
376
376
  func setCustomParameters(provider: AuthProvider, parameters: JSObject, completion: @escaping (Error?) -> Void) {
377
- storage.setCustomParameters(provider: provider, parameters: parameters)
377
+ storage.setCustomParameters(provider: provider.rawValue, parameters: parameters)
378
378
  completion(nil)
379
379
  }
380
380
 
@@ -399,19 +399,10 @@ import Capacitor
399
399
  switch config.provider {
400
400
  case .google:
401
401
  return GoogleAuthProvider(config: config, storage: storage, logger: logger)
402
- case .apple:
403
- return AppleAuthProvider(config: config, storage: storage, logger: logger)
404
- case .microsoft:
405
- return MicrosoftAuthProvider(config: config, storage: storage, logger: logger)
406
- case .facebook:
407
- return FacebookAuthProvider(config: config, storage: storage, logger: logger)
408
- case .github:
409
- return GitHubAuthProvider(config: config, storage: storage, logger: logger)
410
- case .slack:
411
- return SlackAuthProvider(config: config, storage: storage, logger: logger)
412
- case .linkedin:
413
- return LinkedInAuthProvider(config: config, storage: storage, logger: logger)
414
402
  default:
403
+ // Google-first build (2.4.x): non-Google native providers are disabled. Their Swift lives in
404
+ // ios/disabled-native-providers/ (not compiled, not shipped) so this pod no longer depends on
405
+ // the Facebook SDK / MSAL. The JS layer reports PROVIDER_NOT_ENABLED before reaching native.
415
406
  throw AuthManagerError.providerNotImplemented(config.provider)
416
407
  }
417
408
  }
@@ -115,9 +115,11 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
115
115
  ])
116
116
  }
117
117
 
118
- @objc func removeAllListeners(_ call: CAPPluginCall) {
118
+ // CAPPlugin provides a built-in removeAllListeners(_:) in Capacitor 8; override it so our auth-state
119
+ // listener registry is cleared too, then let the base clear Capacitor's listeners and resolve.
120
+ @objc override public func removeAllListeners(_ call: CAPPluginCall) {
119
121
  implementation.removeAllListeners()
120
- call.resolve()
122
+ super.removeAllListeners(call)
121
123
  }
122
124
 
123
125
  @objc func isSupported(_ call: CAPPluginCall) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-auth-manager",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Capacitor + web authentication. Firebase-agnostic native & web Google sign-in (idToken/accessToken) for React, Vue, Angular and vanilla JS — a drop-in alternative to @codetrix-studio/capacitor-google-auth. More providers shipping one at a time.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",