capacitor-auth-manager 2.4.4 → 3.0.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 +174 -0
- package/CHANGELOG.md +119 -0
- package/CapacitorAuthManager.podspec +3 -3
- package/README.md +91 -72
- package/android/build.gradle +17 -25
- package/android/consumer-rules.pro +2 -0
- package/android/proguard-rules.pro +5 -30
- package/android/src/main/AndroidManifest.xml +4 -9
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/AuthErrorCodes.java +32 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/AuthException.java +34 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/AuthStorage.java +46 -25
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManager.java +54 -38
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManagerPlugin.java +77 -54
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleAuthProvider.java +171 -41
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/ProviderFactory.java +5 -0
- package/dist/angular.cjs.js +421 -3376
- package/dist/core.cjs.js +589 -149
- package/dist/esm/angular/auth.guard.d.ts +1 -1
- package/dist/esm/angular/auth.module.d.ts +1 -1
- package/dist/esm/angular/auth.module.js +1 -1
- package/dist/esm/angular/auth.service.d.ts +2 -2
- package/dist/esm/angular/auth.service.js +1 -1
- package/dist/esm/angular/index.d.ts +4 -4
- package/dist/esm/angular/index.js +4 -4
- package/dist/esm/capacitor-plugin.d.ts +2 -3
- package/dist/esm/capacitor-plugin.js +14 -4
- package/dist/esm/core/auth-manager.d.ts +20 -2
- package/dist/esm/core/auth-manager.js +68 -12
- package/dist/esm/core/index.d.ts +5 -4
- package/dist/esm/core/index.js +5 -4
- package/dist/esm/core/provider-manifests.d.ts +1 -1
- package/dist/esm/core/provider-manifests.js +12 -13
- package/dist/esm/core/provider-registry.d.ts +8 -5
- package/dist/esm/core/provider-registry.js +41 -10
- package/dist/esm/core/types.d.ts +2 -2
- package/dist/esm/definitions.d.ts +26 -0
- package/dist/esm/index.d.ts +12 -12
- package/dist/esm/index.js +7 -7
- package/dist/esm/package.json +1 -0
- package/dist/esm/providers/base-provider.d.ts +7 -8
- package/dist/esm/providers/base-provider.js +7 -8
- package/dist/esm/providers/native/google-native-provider.d.ts +13 -2
- package/dist/esm/providers/native/google-native-provider.js +50 -6
- package/dist/esm/providers/oauth-provider.d.ts +2 -2
- package/dist/esm/providers/oauth-provider.js +3 -3
- package/dist/esm/providers/provider-factory.d.ts +5 -5
- package/dist/esm/providers/provider-factory.js +2 -2
- package/dist/esm/providers/web/google-provider.d.ts +74 -18
- package/dist/esm/providers/web/google-provider.js +391 -117
- package/dist/esm/providers/web/index.d.ts +1 -1
- package/dist/esm/providers/web/index.js +1 -1
- package/dist/esm/react/hooks.d.ts +2 -2
- package/dist/esm/react/hooks.js +2 -2
- package/dist/esm/react/index.d.ts +3 -3
- package/dist/esm/react/index.js +3 -3
- package/dist/esm/react/types.d.ts +1 -1
- package/dist/esm/utils/auth-error.d.ts +1 -1
- package/dist/esm/utils/auth-error.js +1 -1
- package/dist/esm/utils/event-emitter.d.ts +1 -1
- package/dist/esm/utils/event-emitter.js +1 -1
- package/dist/esm/utils/pending-verification-store.js +1 -1
- package/dist/esm/utils/storage.d.ts +2 -2
- package/dist/esm/utils/storage.js +31 -7
- package/dist/esm/vue/composables.d.ts +2 -2
- package/dist/esm/vue/composables.js +1 -1
- package/dist/esm/vue/index.d.ts +2 -2
- package/dist/esm/vue/index.js +2 -2
- package/dist/esm/web.d.ts +1 -1
- package/dist/esm/web.js +6 -6
- package/dist/plugin.cjs.js +291 -2771
- package/dist/plugin.js +585 -147
- package/dist/providers-web.cjs.js +1317 -0
- package/dist/react.cjs.js +310 -3265
- package/dist/vue.cjs.js +266 -3221
- package/ios/Plugin/AuthStorage.swift +3 -1
- package/ios/Plugin/GoogleAuthProvider.swift +7 -4
- package/ios/Plugin/Models.swift +28 -0
- package/ios/Plugin/Plugin.swift +64 -40
- package/package.json +55 -33
- package/scripts/configure.js +71 -325
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Capacitor Auth Manager: AI integration guide
|
|
2
|
+
|
|
3
|
+
Release: **3.0.0**. Audience: Claude Code, Codex, and developers integrating Google sign-in.
|
|
4
|
+
Use this guide from the installed package; the npm README and [documentation](https://capacitor-auth-manager-docs.aoneahsan.com) describe the same release.
|
|
5
|
+
|
|
6
|
+
<a id="table-of-contents"></a>
|
|
7
|
+
## 🧭 Table of Contents [#](#table-of-contents)
|
|
8
|
+
|
|
9
|
+
- [Contract](#contract)
|
|
10
|
+
- [Setup](#setup)
|
|
11
|
+
- [Firebase handoff](#firebase)
|
|
12
|
+
- [Platform setup](#platform-setup)
|
|
13
|
+
- [Tokens and state](#tokens-and-state)
|
|
14
|
+
- [Errors and security](#errors-and-security)
|
|
15
|
+
- [App acceptance checks](#acceptance)
|
|
16
|
+
|
|
17
|
+
<a id="contract"></a>
|
|
18
|
+
## 🔧 Contract [#](#contract)
|
|
19
|
+
|
|
20
|
+
| Decision | Contract |
|
|
21
|
+
|---|---|
|
|
22
|
+
| Enabled provider | `AuthProvider.GOOGLE` only; other recognized providers throw `PROVIDER_NOT_ENABLED` |
|
|
23
|
+
| Application responsibility | Google OAuth registration, Firebase initialization, app sessions, authorization, translations |
|
|
24
|
+
| Package responsibility | Platform dispatch, Google SDK invocation, normalized `{ user, credential }`, observable local state |
|
|
25
|
+
| Firebase dependency | None; install Firebase in the app |
|
|
26
|
+
| Node | ≥24 for installation/tooling; imports are server-safe, sign-in runs in a browser or native app |
|
|
27
|
+
| Capacitor | `@capacitor/core` is required even on web; peers support 7.4.2 and 8.x |
|
|
28
|
+
| Native floors | Android API 24; iOS 15; native builds require JDK 21 |
|
|
29
|
+
| Upgrade from 2.4.x | Node floor rises, iOS floor rises, Angular peers are 22.x; web may return an access token instead of an ID token |
|
|
30
|
+
|
|
31
|
+
Read the actual installed `.d.ts` declarations before inventing a method. Public imports are
|
|
32
|
+
`capacitor-auth-manager`, `/core`, `/react`, `/vue`, `/angular`, `/providers/web`, and `/package.json`.
|
|
33
|
+
The `/providers/web` entry exports `GoogleAuthProviderWeb`; construct it with Google options or an injected provider config.
|
|
34
|
+
React exports `useAuth`, `useAuthState`, `useUser`, `useIsAuthenticated`, `useAuthProvider`.
|
|
35
|
+
The root exports the `auth` singleton, `AuthProvider`, `AuthErrorCode`, `AuthError`, `isAuthError`, storage classes, logger, and shared types.
|
|
36
|
+
|
|
37
|
+
<a id="setup"></a>
|
|
38
|
+
## 📦 Setup [#](#setup)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
yarn add capacitor-auth-manager@3.0.0 @capacitor/core firebase
|
|
42
|
+
# Native applications only, after the platform projects exist:
|
|
43
|
+
yarn cap sync
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Use the app's existing Capacitor CLI and keep its core, CLI, Android, and iOS versions aligned.
|
|
47
|
+
Configure once in the browser application bootstrap, before rendering enabled sign-in controls.
|
|
48
|
+
OAuth client IDs are public identifiers; client secrets never belong in a frontend or Capacitor config.
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { auth, AuthProvider } from 'capacitor-auth-manager';
|
|
52
|
+
|
|
53
|
+
export async function prepareGoogle(clientId: string, iosClientId?: string) {
|
|
54
|
+
auth.configure({
|
|
55
|
+
providers: {
|
|
56
|
+
[AuthProvider.GOOGLE]: {
|
|
57
|
+
clientId,
|
|
58
|
+
serverClientId: clientId,
|
|
59
|
+
iosClientId,
|
|
60
|
+
webFlow: 'popup',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
persistence: 'memory',
|
|
64
|
+
});
|
|
65
|
+
await auth.prepare(AuthProvider.GOOGLE);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`prepare()` loads Google Identity Services or initializes the native SDK without opening a sign-in prompt.
|
|
70
|
+
Disable the app's sign-in button until preparation succeeds. Call sign-in from a direct click, never an effect,
|
|
71
|
+
a timeout, or a background refresh. Keep `configure()` outside render loops; configure before `prepare()`.
|
|
72
|
+
A provider instance keeps its initial options until disposed; do not rotate client IDs during a session.
|
|
73
|
+
|
|
74
|
+
<a id="firebase"></a>
|
|
75
|
+
## 🚀 Firebase handoff [#](#firebase)
|
|
76
|
+
|
|
77
|
+
The consuming app initializes Firebase and supplies its `Auth` instance. This function works with both web flows and native credentials:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { auth, AuthProvider } from 'capacitor-auth-manager';
|
|
81
|
+
import { GoogleAuthProvider, signInWithCredential, signOut, type Auth } from 'firebase/auth';
|
|
82
|
+
|
|
83
|
+
export async function signInGoogle(firebaseAuth: Auth) {
|
|
84
|
+
const { credential } = await auth.signIn(AuthProvider.GOOGLE);
|
|
85
|
+
const { idToken, accessToken } = credential;
|
|
86
|
+
if (!idToken && !accessToken) throw new Error('Google returned no usable credential');
|
|
87
|
+
try {
|
|
88
|
+
return await signInWithCredential(
|
|
89
|
+
firebaseAuth,
|
|
90
|
+
GoogleAuthProvider.credential(idToken ?? null, accessToken ?? null),
|
|
91
|
+
);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
await auth.signOut().catch(() => undefined);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export async function signOutGoogle(firebaseAuth: Auth) {
|
|
99
|
+
// Attempt both sign-outs; failure in one must not skip the other.
|
|
100
|
+
const results = await Promise.allSettled([signOut(firebaseAuth), auth.signOut()]);
|
|
101
|
+
const failed = results.find((result) => result.status === 'rejected');
|
|
102
|
+
if (failed?.status === 'rejected') throw failed.reason;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Use Firebase's `onAuthStateChanged` to drive protected routes and your app's authenticated UI.
|
|
107
|
+
The package's `user` and `isAuthenticated` indicate the local Google flow, not a verified Firebase session.
|
|
108
|
+
For authenticated backend requests, get a **Firebase** ID token from `firebaseAuth.currentUser.getIdToken()`;
|
|
109
|
+
`auth.getIdToken()` returns a **Google** ID token and is not interchangeable with it.
|
|
110
|
+
|
|
111
|
+
<a id="platform-setup"></a>
|
|
112
|
+
## 📱 Platform setup [#](#platform-setup)
|
|
113
|
+
|
|
114
|
+
| Platform | Required configuration |
|
|
115
|
+
|---|---|
|
|
116
|
+
| Web | Enable Google in Firebase Auth. Register production and development origins on the Web OAuth client and app domains in Firebase Auth. Load GIS from `https://accounts.google.com/gsi/client`; allow the Google endpoints required by your CSP. Popup flows require a click and appropriate COOP settings. |
|
|
117
|
+
| Android | Register the exact application ID and debug, release, and Play App Signing SHA-1/SHA-256 fingerprints. Use the Web OAuth client ID as `serverClientId`. A Google account/Play Services must be available. `google-services.json` belongs to the consuming Firebase app configuration, not this package. |
|
|
118
|
+
| iOS | Register the exact bundle ID and iOS OAuth client. Set `iosClientId` or `GIDClientID`, and the reversed iOS client ID in `CFBundleURLTypes`. CocoaPods consumers use GoogleSignIn 10.x; set the deployment target to iOS 15 or later. With Capacitor 8 use `yarn cap add ios --packagemanager CocoaPods`; this package currently has no Swift Package Manager manifest. |
|
|
119
|
+
|
|
120
|
+
[Web](https://capacitor-auth-manager-docs.aoneahsan.com/platforms/web),
|
|
121
|
+
[Android](https://capacitor-auth-manager-docs.aoneahsan.com/platforms/android), and
|
|
122
|
+
[iOS](https://capacitor-auth-manager-docs.aoneahsan.com/platforms/ios) cover the native steps.
|
|
123
|
+
|
|
124
|
+
<a id="tokens-and-state"></a>
|
|
125
|
+
## 🧩 Tokens and state [#](#tokens-and-state)
|
|
126
|
+
|
|
127
|
+
| Flow | Credential fields |
|
|
128
|
+
|---|---|
|
|
129
|
+
| Web `webFlow: 'popup'` | `accessToken`; no `idToken` or refresh token |
|
|
130
|
+
| Web `webFlow: 'one-tap'` | `idToken`; no access token |
|
|
131
|
+
| Web `webFlow: 'auto'` (default) | One-Tap ID token or popup access token; suppression may require another click to open a popup |
|
|
132
|
+
| Android | `idToken`; no access token/server auth code from the sign-in call |
|
|
133
|
+
| iOS | `idToken`, `accessToken`, optional `serverAuthCode` when configured |
|
|
134
|
+
|
|
135
|
+
`auth.getIdToken({forceRefresh: true})` can prompt again. A popup-only web session has no Google ID token.
|
|
136
|
+
Use Firebase for background app-session refresh; avoid calling Google interactive refresh on a timer.
|
|
137
|
+
`auth.signOut()` clears the package's local session; also sign out Firebase as shown above.
|
|
138
|
+
Android `revokeAccess()` clears local/Credential Manager state, not Google's server-side grant.
|
|
139
|
+
Account linking, account deletion, and profile updates in Firebase belong to Firebase's API.
|
|
140
|
+
|
|
141
|
+
Default JS storage persists profile metadata, never token strings. Android credentials are kept in process memory;
|
|
142
|
+
iOS relies on GoogleSignIn's SDK Keychain and no longer duplicates credentials in UserDefaults.
|
|
143
|
+
The major upgrade removes the package's legacy Android credential store and iOS credential copies; users may need to sign in again.
|
|
144
|
+
`CapacitorPreferencesStorage` is not encrypted secure storage. If your app persists secrets, it owns a reviewed Keychain/Keystore adapter.
|
|
145
|
+
A cached profile is not an authorization decision. Firebase/server verification is required.
|
|
146
|
+
|
|
147
|
+
<a id="errors-and-security"></a>
|
|
148
|
+
## 🚑 Errors and security [#](#errors-and-security)
|
|
149
|
+
|
|
150
|
+
| Signal | App action |
|
|
151
|
+
|---|---|
|
|
152
|
+
| `USER_CANCELLED`, `POPUP_CLOSED_BY_USER` | Return to the idle sign-in UI |
|
|
153
|
+
| `POPUP_BLOCKED` | Retry from a fresh click with `webFlow: 'popup'`; preload via `prepare()` |
|
|
154
|
+
| `MISSING_CONFIGURATION` | Correct client IDs/native setup; do not retry in a loop |
|
|
155
|
+
| `NETWORK_ERROR`, SDK load failure | Show a translated retry action after connectivity recovers |
|
|
156
|
+
| `OPERATION_NOT_ALLOWED` during sign-in | An operation is already pending; keep the button disabled |
|
|
157
|
+
| `INVALID_TOKEN`, `INVALID_NONCE`, `TOKEN_EXPIRED` | Reject the credential and reauthenticate |
|
|
158
|
+
| `PROVIDER_NOT_ENABLED` | Use Google; other providers are roadmap code |
|
|
159
|
+
|
|
160
|
+
Use `isAuthError(error)` and `AuthErrorCode` to map errors to the app's i18n keys. Catch rejected event-handler
|
|
161
|
+
promises; never log credentials, tokens, or client secrets. The browser validates issuer, audience, subject,
|
|
162
|
+
expiry, a configured nonce, and a configured Workspace domain, but does not verify JWT signatures.
|
|
163
|
+
Google/Firebase/server verification establishes trust. Never send an OAuth access token to an ID-token-only backend.
|
|
164
|
+
|
|
165
|
+
For a custom ID-token backend, choose the One-Tap/native ID-token path, require `credential.idToken`, verify
|
|
166
|
+
signature/issuer/audience/expiry/nonce on the server, and issue your own session. Do not decode a token and trust its claims.
|
|
167
|
+
|
|
168
|
+
<a id="acceptance"></a>
|
|
169
|
+
## 🧪 App acceptance checks [#](#acceptance)
|
|
170
|
+
|
|
171
|
+
Verify a fresh sign-in, returning sign-in, cancel/retry, blocked popup, offline/retry, cold restart, token expiry,
|
|
172
|
+
and sign-out on each deployed platform. Verify release signing fingerprints and production origins, not only debug setup.
|
|
173
|
+
Confirm Firebase receives the expected user, protected routes follow Firebase state, and storage/logs contain no secret tokens.
|
|
174
|
+
Native compile checks and mocked Google tests cannot certify your OAuth configuration or a real-device sign-in.
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,125 @@ 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.0.0] — 2026-10-09
|
|
9
|
+
|
|
10
|
+
### Breaking changes
|
|
11
|
+
|
|
12
|
+
- Node installation/tooling floor is now 24; iOS requires 15 and GoogleSignIn 10.x. Angular adapters support 22.x; older unverified ranges are removed.
|
|
13
|
+
- Web auto sign-in may return a popup access token instead of an ID token. Firebase handoff must use `GoogleAuthProvider.credential(idToken ?? null, accessToken ?? null)`.
|
|
14
|
+
- Default native storage no longer duplicates bearer credentials on disk. The Android legacy credential store and iOS credential copies are removed on upgrade; reauthentication may be required.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- `auth.prepare(provider)` initializes the SDK before a click without opening a sign-in prompt.
|
|
19
|
+
- A packaged AI integration guide for React/Firebase, native setup, exact imports, error handling, and session ownership.
|
|
20
|
+
- Google-flow, storage, provider initialization, and sign-out race regression tests; tarball smoke loads every public JavaScript entry in both formats.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Missing requested nonce, expiry, subject, and Workspace-domain claims are rejected in the web ID-token path.
|
|
25
|
+
- Duplicate Google calls fail explicitly; provider initialization is coalesced and invalidated safely on disposal.
|
|
26
|
+
- A late session restore cannot authenticate after sign-out; disabled providers are excluded from the supported-provider list.
|
|
27
|
+
- One-Tap and popup waits are bounded; sign-out/disposal settles outstanding requests and late callbacks are ignored. Userinfo requests have a network deadline.
|
|
28
|
+
- Google web provider construction accepts the documented options shape.
|
|
29
|
+
- The packed Android manifest declares only INTERNET; consumer R8 rules preserve reflected plugin entry points.
|
|
30
|
+
- Native Swift/Java sources are included in the packed artifact. CommonJS root/framework adapters share one auth singleton, and providers/web exports its Google class.
|
|
31
|
+
- iOS credential copies no longer enter UserDefaults. Android removes deprecated security-crypto and keeps credentials in memory.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- Direct dependencies updated to current stable versions, retaining the documented TypeScript 6 ecosystem pin.
|
|
36
|
+
- Android uses Credential Manager 1.6.0 and googleid 1.1.1; GoogleSignIn is 10.x.
|
|
37
|
+
- Yarn owns local build/test scripts. Trapeze tooling is retained for native configuration.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## [2.5.0] — unpublished source changes, 2026-09-08
|
|
41
|
+
|
|
42
|
+
Google sign-in hardened on every layer. Closes all five entries that `2.4.3` documented in
|
|
43
|
+
`docs/REPORTED-ISSUES.md`, fixes the runtime defects found while reviewing the native bridge, and gives the
|
|
44
|
+
native layers a real error-code channel. The Android plugin and the example app are **compiled and run on an
|
|
45
|
+
emulator** (Gradle 8.14.3 / AGP 8.13 / JDK 21 / compileSdk 36, emulator API 37) before release; the iOS
|
|
46
|
+
change below is the one part that no machine here can compile, and it ships unverified until the next iOS
|
|
47
|
+
device test.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- **ISSUE-001 — bare Node ESM could not import the package.** Every relative specifier in `src/` now carries
|
|
52
|
+
its `.js` extension (155 specifiers across 41 files), so `dist/esm` resolves under Node's ESM resolver as
|
|
53
|
+
well as under bundlers. Guarded by the new tarball smoke test.
|
|
54
|
+
- **ISSUE-002 — importing the package threw `window is not defined`.** The `auth` singleton is created lazily
|
|
55
|
+
on first use (a `Proxy` keeps `import { auth }` unchanged), and `WebStorage` falls back to in-memory storage
|
|
56
|
+
when `window` is absent or the browser refuses storage access (private mode). `"sideEffects": false` is now
|
|
57
|
+
true.
|
|
58
|
+
- **ISSUE-003 — `@capacitor/core` was declared optional but required.** It is a required peer now.
|
|
59
|
+
- **ISSUE-004 — `capacitor-biometric-authentication` was installed for every consumer.** Removed from
|
|
60
|
+
`optionalDependencies`; it returns as an optional peer when the biometric provider is re-enabled.
|
|
61
|
+
- **ISSUE-005 — `engines.node` was untested and disagreed with `.nvmrc`.** The floor is now `>=24.0.0`
|
|
62
|
+
(owner decision: current and latest Node only, no legacy targets) and CI builds, lints and runs the tarball
|
|
63
|
+
smoke test on Node 24 and 26. Node is a build/install requirement only — the package runs in a browser or a
|
|
64
|
+
webview.
|
|
65
|
+
- **Web One-Tap dismissed by the user hung `signIn()` forever.** A dismissed prompt now rejects with
|
|
66
|
+
`USER_CANCELLED`; a suppressed prompt rejects with `POPUP_BLOCKED` (or falls back, see Added).
|
|
67
|
+
- **Native `getCurrentUser()` returned `{}` and the app treated it as a signed-in user.** The bridge now
|
|
68
|
+
normalizes any result without a string `uid` to `null`, so a cold start with no session is "signed out"
|
|
69
|
+
instead of authenticated-with-an-empty-user.
|
|
70
|
+
- **Android `getCurrentUser()` resolved the same plugin call twice** when no provider was active. It answers
|
|
71
|
+
exactly once and remembers which provider owns the restored session.
|
|
72
|
+
- **Android manifest declared `READ_SMS`, `RECEIVE_SMS` and `USE_BIOMETRIC`** for providers that are disabled.
|
|
73
|
+
Only `INTERNET` remains; the SMS permissions are Play-restricted and were a store-rejection risk for every
|
|
74
|
+
consumer.
|
|
75
|
+
- Per-call sign-in options (`nonce`, `loginHint`, the new flow selectors) now reach the native side; they
|
|
76
|
+
were previously dropped because the manager flattens them before calling the provider.
|
|
77
|
+
- **`auth.getIdToken()` failed on iOS and Android** with `OPERATION_NOT_ALLOWED` even though both native
|
|
78
|
+
layers implement it, because the native bridge never exposed the method the manager looks for. It is
|
|
79
|
+
implemented now, and the Android plugin method also accepts the flat `{ provider, forceRefresh }` shape
|
|
80
|
+
the bridge sends (it previously read a nested `options` object only).
|
|
81
|
+
- **Native errors reached JavaScript without a code.** Android rejected with a bare message and iOS rejected
|
|
82
|
+
with `localizedDescription`, so `AuthError.fromError` had to guess the code by substring-matching the
|
|
83
|
+
message: anything that did not contain "cancelled", "network" or "timeout" surfaced as
|
|
84
|
+
`auth/internal-error`. Both platforms now send a real `AuthErrorCode` — a cancelled sheet is
|
|
85
|
+
`auth/user-cancelled`, an interrupted request is `auth/network-error`, a missing `serverClientId` is
|
|
86
|
+
`auth/missing-configuration`, and so on. (Android verified on an emulator; iOS unverified, see above.)
|
|
87
|
+
- **Android fell back to plaintext `SharedPreferences`** when the keystore refused a master key, writing ID
|
|
88
|
+
tokens to disk in the clear with no signal. It now keeps the session in memory for the life of the process
|
|
89
|
+
and logs the degradation; `AuthStorage.isEncrypted()` reports which mode is active.
|
|
90
|
+
- **`npm run configure` emitted a `GoogleSignInOptions` manifest entry** from the deprecated
|
|
91
|
+
`com.google.android.gms.auth.api.signin` flow this plugin stopped using in 2.4.2. Pasting it did nothing;
|
|
92
|
+
the wizard now says Google needs no manifest entry.
|
|
93
|
+
|
|
94
|
+
### Added
|
|
95
|
+
|
|
96
|
+
- **`GoogleAuthOptions.webFlow`** (`'auto' | 'one-tap' | 'popup'`, default `'auto'`): One-Tap first, then a
|
|
97
|
+
Google Identity Services OAuth2 **popup fallback** whenever the browser does not display One-Tap (cooldown,
|
|
98
|
+
FedCM opt-out, third-party-cookie settings). The popup returns `accessToken` plus the Google profile;
|
|
99
|
+
Firebase accepts `GoogleAuthProvider.credential(idToken ?? null, accessToken)`.
|
|
100
|
+
- **`GoogleAuthOptions.androidFlow`** (`'auto' | 'bottom-sheet' | 'button'`, default `'auto'`): the
|
|
101
|
+
Credential Manager bottom sheet first, then the explicit **Sign in with Google button flow**
|
|
102
|
+
(`GetSignInWithGoogleOption`) when no authorized account is offered — that flow can add an account.
|
|
103
|
+
- Both selectors are also accepted per call: `auth.signIn({ provider, options: { webFlow: 'popup' } })`.
|
|
104
|
+
- `getAuth()` export alongside `auth` for callers who prefer an explicit accessor.
|
|
105
|
+
- Web `getIdToken()` and `revokeAccess()` implementations (revoke uses the OAuth2 token when present).
|
|
106
|
+
- **Tarball smoke test** (`yarn smoke:tarball`, `node:test`): packs the package, installs the tarball into a
|
|
107
|
+
scratch directory and imports it under bare Node (ESM and CJS). Wired into `prepublishOnly`.
|
|
108
|
+
|
|
109
|
+
### Changed
|
|
110
|
+
|
|
111
|
+
- `@capacitor/core` peer: optional → required.
|
|
112
|
+
- Android: `androidx.credentials` 1.3.0 → 1.5.0, `security-crypto` 1.1.0-alpha06 → 1.1.0 (stable),
|
|
113
|
+
AGP/compileSdk/minSdk fallbacks aligned with Capacitor 8 (8.13.0 / 36 / 24), `lintOptions` → `lint`,
|
|
114
|
+
the unused direct `play-services-auth` dependency removed (still provided transitively), Facebook/MSAL
|
|
115
|
+
ProGuard rules dropped.
|
|
116
|
+
- `packageManager: yarn@4.17.1` declared so corepack picks the right Yarn.
|
|
117
|
+
- Google provider manifest no longer names a non-existent `@google/gsi` npm package.
|
|
118
|
+
- README: `renderButton` is documented as what it is — a method on `GoogleAuthProviderWeb`, reached by
|
|
119
|
+
importing `capacitor-auth-manager/providers/web` — rather than implied to be on the `auth` singleton,
|
|
120
|
+
where readers could not find it.
|
|
121
|
+
|
|
122
|
+
### Not changed on purpose
|
|
123
|
+
|
|
124
|
+
- iOS `GoogleSignIn ~> 7.1` stays. A major SDK bump without a compile check is not acceptable; it moves in
|
|
125
|
+
a release that is verified on a Mac.
|
|
126
|
+
|
|
8
127
|
## [2.4.4] - 2026-07-25
|
|
9
128
|
|
|
10
129
|
### Fixed
|
|
@@ -11,13 +11,13 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target = '
|
|
14
|
+
s.ios.deployment_target = '15.0'
|
|
15
15
|
s.swift_version = '5.9'
|
|
16
|
-
s.dependency 'Capacitor'
|
|
16
|
+
s.dependency 'Capacitor', '>= 7.4.2', '< 9.0'
|
|
17
17
|
|
|
18
18
|
# Google Sign-In — the only enabled provider as of 2.4.x (Firebase-agnostic). Pure-Swift SDK,
|
|
19
19
|
# no Objective-C bridging header required.
|
|
20
|
-
s.dependency 'GoogleSignIn', '~>
|
|
20
|
+
s.dependency 'GoogleSignIn', '~> 10.0'
|
|
21
21
|
|
|
22
22
|
# NOTE: Google-first build. The Facebook (FBSDKLoginKit) and Microsoft (MSAL) pod dependencies were
|
|
23
23
|
# removed so this plugin no longer pulls heavy auth SDKs into every consumer app. Those providers'
|