capacitor-auth-manager 2.4.4 → 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.
Files changed (86) hide show
  1. package/AI-INTEGRATION-GUIDE.md +176 -0
  2. package/CHANGELOG.md +143 -0
  3. package/CapacitorAuthManager.podspec +3 -3
  4. package/README.md +99 -76
  5. package/android/build.gradle +23 -25
  6. package/android/consumer-rules.pro +14 -0
  7. package/android/proguard-rules.pro +5 -30
  8. package/android/src/main/AndroidManifest.xml +4 -9
  9. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/ActivityLauncher.java +26 -0
  10. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/AuthErrorCodes.java +32 -0
  11. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/AuthException.java +34 -0
  12. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/AuthStorage.java +46 -25
  13. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManager.java +62 -40
  14. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManagerPlugin.java +124 -66
  15. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleAuthProvider.java +225 -374
  16. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleCredentialManagerSignIn.java +175 -0
  17. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleLegacySignIn.java +133 -0
  18. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleProfileCallback.java +8 -0
  19. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleResultMapper.java +158 -0
  20. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/ProviderFactory.java +11 -3
  21. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/SigningDiagnostics.java +76 -0
  22. package/dist/angular.cjs.js +421 -3376
  23. package/dist/core.cjs.js +589 -149
  24. package/dist/esm/angular/auth.guard.d.ts +1 -1
  25. package/dist/esm/angular/auth.module.d.ts +1 -1
  26. package/dist/esm/angular/auth.module.js +1 -1
  27. package/dist/esm/angular/auth.service.d.ts +2 -2
  28. package/dist/esm/angular/auth.service.js +1 -1
  29. package/dist/esm/angular/index.d.ts +4 -4
  30. package/dist/esm/angular/index.js +4 -4
  31. package/dist/esm/capacitor-plugin.d.ts +2 -3
  32. package/dist/esm/capacitor-plugin.js +14 -4
  33. package/dist/esm/core/auth-manager.d.ts +20 -2
  34. package/dist/esm/core/auth-manager.js +68 -12
  35. package/dist/esm/core/index.d.ts +5 -4
  36. package/dist/esm/core/index.js +5 -4
  37. package/dist/esm/core/provider-manifests.d.ts +1 -1
  38. package/dist/esm/core/provider-manifests.js +12 -13
  39. package/dist/esm/core/provider-registry.d.ts +8 -5
  40. package/dist/esm/core/provider-registry.js +41 -10
  41. package/dist/esm/core/types.d.ts +2 -2
  42. package/dist/esm/definitions.d.ts +29 -0
  43. package/dist/esm/index.d.ts +12 -12
  44. package/dist/esm/index.js +7 -7
  45. package/dist/esm/package.json +1 -0
  46. package/dist/esm/providers/base-provider.d.ts +7 -8
  47. package/dist/esm/providers/base-provider.js +7 -8
  48. package/dist/esm/providers/native/google-native-provider.d.ts +13 -2
  49. package/dist/esm/providers/native/google-native-provider.js +50 -6
  50. package/dist/esm/providers/oauth-provider.d.ts +2 -2
  51. package/dist/esm/providers/oauth-provider.js +3 -3
  52. package/dist/esm/providers/provider-factory.d.ts +5 -5
  53. package/dist/esm/providers/provider-factory.js +2 -2
  54. package/dist/esm/providers/web/google-provider.d.ts +74 -18
  55. package/dist/esm/providers/web/google-provider.js +391 -117
  56. package/dist/esm/providers/web/index.d.ts +1 -1
  57. package/dist/esm/providers/web/index.js +1 -1
  58. package/dist/esm/react/hooks.d.ts +2 -2
  59. package/dist/esm/react/hooks.js +2 -2
  60. package/dist/esm/react/index.d.ts +3 -3
  61. package/dist/esm/react/index.js +3 -3
  62. package/dist/esm/react/types.d.ts +1 -1
  63. package/dist/esm/utils/auth-error.d.ts +1 -1
  64. package/dist/esm/utils/auth-error.js +1 -1
  65. package/dist/esm/utils/event-emitter.d.ts +1 -1
  66. package/dist/esm/utils/event-emitter.js +1 -1
  67. package/dist/esm/utils/pending-verification-store.js +1 -1
  68. package/dist/esm/utils/storage.d.ts +2 -2
  69. package/dist/esm/utils/storage.js +31 -7
  70. package/dist/esm/vue/composables.d.ts +2 -2
  71. package/dist/esm/vue/composables.js +1 -1
  72. package/dist/esm/vue/index.d.ts +2 -2
  73. package/dist/esm/vue/index.js +2 -2
  74. package/dist/esm/web.d.ts +1 -1
  75. package/dist/esm/web.js +6 -6
  76. package/dist/plugin.cjs.js +291 -2771
  77. package/dist/plugin.js +585 -147
  78. package/dist/providers-web.cjs.js +1317 -0
  79. package/dist/react.cjs.js +310 -3265
  80. package/dist/vue.cjs.js +266 -3221
  81. package/ios/Plugin/AuthStorage.swift +3 -1
  82. package/ios/Plugin/GoogleAuthProvider.swift +7 -4
  83. package/ios/Plugin/Models.swift +28 -0
  84. package/ios/Plugin/Plugin.swift +64 -40
  85. package/package.json +54 -32
  86. package/scripts/configure.js +71 -325
@@ -1,8 +1,8 @@
1
- import { AuthProvider, AuthResult, AuthUser, SignInOptions, SignOutOptions, AuthCredential, RefreshTokenOptions, AuthStateChangeCallback, LinkAccountOptions, UnlinkAccountOptions, ProviderOptions, AuthPersistence } from '../definitions';
2
- import { EventEmitter, UnsubscribeFn } from '../utils/event-emitter';
3
- import { StorageInterface } from '../utils/storage';
4
- import { Logger } from '../utils/logger';
5
- import { AuthProviderInterface } from '../core/types';
1
+ import { AuthProvider, AuthResult, AuthUser, SignInOptions, SignOutOptions, AuthCredential, RefreshTokenOptions, AuthStateChangeCallback, LinkAccountOptions, UnlinkAccountOptions, ProviderOptions, AuthPersistence } from '../definitions.js';
2
+ import { EventEmitter, UnsubscribeFn } from '../utils/event-emitter.js';
3
+ import { StorageInterface } from '../utils/storage.js';
4
+ import { Logger } from '../utils/logger.js';
5
+ import { AuthProviderInterface } from '../core/types.js';
6
6
  export interface BaseProviderConfig {
7
7
  provider: AuthProvider;
8
8
  options: ProviderOptions;
@@ -16,9 +16,8 @@ export interface BaseProviderConfig {
16
16
  * The standalone providers are public (exported from `capacitor-auth-manager/providers/web`) and
17
17
  * get constructed two ways: the factory/registry pass a full {@link BaseProviderConfig}, while
18
18
  * tests and direct consumers pass the provider's own bare options object. This helper accepts
19
- * either — a bare object is wrapped with an in-memory storage (`AuthPersistence.NONE`, so it never
20
- * touches `window` and stays safe under SSR / Node test environments) plus the shared
21
- * {@link defaultLogger}. Callers that pass a full config keep their injected storage/logger.
19
+ * either — a bare object is wrapped with an in-memory storage (`AuthPersistence.NONE`) plus the
20
+ * shared {@link defaultLogger}. Callers that pass a full config keep their injected storage/logger.
22
21
  */
23
22
  export declare function resolveProviderConfig(provider: AuthProvider, input?: unknown): BaseProviderConfig;
24
23
  export declare abstract class BaseAuthProvider implements AuthProviderInterface {
@@ -1,17 +1,16 @@
1
- import { AuthErrorCode, AuthPersistence, } from '../definitions';
2
- import { AuthError } from '../utils/auth-error';
3
- import { EventEmitter } from '../utils/event-emitter';
4
- import { WebStorage } from '../utils/storage';
5
- import { defaultLogger } from '../utils/logger';
1
+ import { AuthErrorCode, AuthPersistence, } from '../definitions.js';
2
+ import { AuthError } from '../utils/auth-error.js';
3
+ import { EventEmitter } from '../utils/event-emitter.js';
4
+ import { WebStorage } from '../utils/storage.js';
5
+ import { defaultLogger } from '../utils/logger.js';
6
6
  /**
7
7
  * Normalize a provider constructor argument into a full {@link BaseProviderConfig}.
8
8
  *
9
9
  * The standalone providers are public (exported from `capacitor-auth-manager/providers/web`) and
10
10
  * get constructed two ways: the factory/registry pass a full {@link BaseProviderConfig}, while
11
11
  * tests and direct consumers pass the provider's own bare options object. This helper accepts
12
- * either — a bare object is wrapped with an in-memory storage (`AuthPersistence.NONE`, so it never
13
- * touches `window` and stays safe under SSR / Node test environments) plus the shared
14
- * {@link defaultLogger}. Callers that pass a full config keep their injected storage/logger.
12
+ * either — a bare object is wrapped with an in-memory storage (`AuthPersistence.NONE`) plus the
13
+ * shared {@link defaultLogger}. Callers that pass a full config keep their injected storage/logger.
15
14
  */
16
15
  export function resolveProviderConfig(provider, input) {
17
16
  if (typeof input === 'object' &&
@@ -1,5 +1,5 @@
1
- import { AuthResult, AuthUser, SignInOptions, SignOutOptions, RefreshTokenOptions } from '../../definitions';
2
- import { BaseAuthProvider } from '../base-provider';
1
+ import { AuthResult, AuthUser, SignInOptions, SignOutOptions, RefreshTokenOptions } from '../../definitions.js';
2
+ import { BaseAuthProvider } from '../base-provider.js';
3
3
  /**
4
4
  * Native Google provider — the implementation the registry loads on **iOS / Android**.
5
5
  *
@@ -20,6 +20,17 @@ export declare class GoogleNativeProvider extends BaseAuthProvider {
20
20
  signIn(options?: SignInOptions): Promise<AuthResult>;
21
21
  signOut(_options?: SignOutOptions): Promise<void>;
22
22
  refreshToken(_options?: RefreshTokenOptions): Promise<AuthResult>;
23
+ /**
24
+ * The current Google ID token, refreshed through the platform SDK when `forceRefresh` is set.
25
+ *
26
+ * `AuthManagerCore.getIdToken` looks for this method on the resolved provider and throws
27
+ * `OPERATION_NOT_ALLOWED` when it is missing, so without it `auth.getIdToken()` failed on iOS and
28
+ * Android even though both native layers implement it — while the same call worked on web.
29
+ *
30
+ * Capacitor cannot resolve a bare string, so the native side answers `{ token }`; the web
31
+ * fallback in `src/web.ts` resolves the string itself. Read both shapes.
32
+ */
33
+ getIdToken(forceRefresh?: boolean): Promise<string>;
23
34
  getCurrentUser(): Promise<AuthUser | null>;
24
35
  revokeAccess(_token?: string): Promise<void>;
25
36
  isSupported(): Promise<boolean>;
@@ -1,7 +1,7 @@
1
- import { AuthProvider, } from '../../definitions';
2
- import { BaseAuthProvider, resolveProviderConfig, } from '../base-provider';
3
- import { AuthError } from '../../utils/auth-error';
4
- import { CapacitorAuthManager } from '../../capacitor-plugin';
1
+ import { AuthProvider, AuthErrorCode, } from '../../definitions.js';
2
+ import { BaseAuthProvider, resolveProviderConfig, } from '../base-provider.js';
3
+ import { AuthError } from '../../utils/auth-error.js';
4
+ import { CapacitorAuthManager } from '../../capacitor-plugin.js';
5
5
  /**
6
6
  * Native Google provider — the implementation the registry loads on **iOS / Android**.
7
7
  *
@@ -30,6 +30,7 @@ export class GoogleNativeProvider extends BaseAuthProvider {
30
30
  // Hand the Google config (clientId / serverClientId / iosClientId / scopes) to the native side
31
31
  // once; subsequent signIn() calls only pass per-request SignInProviderOptions.
32
32
  await CapacitorAuthManager.initialize({
33
+ persistence: this.persistence,
33
34
  providers: [
34
35
  {
35
36
  provider: AuthProvider.GOOGLE,
@@ -49,9 +50,16 @@ export class GoogleNativeProvider extends BaseAuthProvider {
49
50
  await this.initialize();
50
51
  }
51
52
  try {
53
+ // AuthManagerCore spreads the per-call `options` to the top level before calling us, so read
54
+ // both shapes: a nested `options` object (direct plugin-style callers) or the flattened one.
55
+ const source = (options !== null && options !== void 0 ? options : {});
56
+ const { credentials, options: nested } = source;
57
+ const flat = Object.fromEntries(Object.entries(source).filter(([key]) => !['provider', 'credentials', 'options'].includes(key)));
58
+ const perCall = Object.assign(Object.assign({}, flat), (nested !== null && nested !== void 0 ? nested : {}));
52
59
  const result = await CapacitorAuthManager.signIn({
53
60
  provider: AuthProvider.GOOGLE,
54
- options: options === null || options === void 0 ? void 0 : options.options,
61
+ credentials,
62
+ options: perCall,
55
63
  });
56
64
  await this.setCurrentUser(result.user);
57
65
  return result;
@@ -85,9 +93,45 @@ export class GoogleNativeProvider extends BaseAuthProvider {
85
93
  throw AuthError.fromError(error, AuthProvider.GOOGLE);
86
94
  }
87
95
  }
96
+ /**
97
+ * The current Google ID token, refreshed through the platform SDK when `forceRefresh` is set.
98
+ *
99
+ * `AuthManagerCore.getIdToken` looks for this method on the resolved provider and throws
100
+ * `OPERATION_NOT_ALLOWED` when it is missing, so without it `auth.getIdToken()` failed on iOS and
101
+ * Android even though both native layers implement it — while the same call worked on web.
102
+ *
103
+ * Capacitor cannot resolve a bare string, so the native side answers `{ token }`; the web
104
+ * fallback in `src/web.ts` resolves the string itself. Read both shapes.
105
+ */
106
+ async getIdToken(forceRefresh = false) {
107
+ var _a;
108
+ if (!this.isInitialized) {
109
+ await this.initialize();
110
+ }
111
+ try {
112
+ const raw = (await CapacitorAuthManager.getIdToken({
113
+ provider: AuthProvider.GOOGLE,
114
+ forceRefresh,
115
+ }));
116
+ const token = typeof raw === 'string' ? raw : ((_a = raw === null || raw === void 0 ? void 0 : raw.token) !== null && _a !== void 0 ? _a : '');
117
+ if (!token) {
118
+ throw new AuthError(AuthErrorCode.NO_AUTH_SESSION, 'No Google ID token available. Sign in again.', AuthProvider.GOOGLE);
119
+ }
120
+ return token;
121
+ }
122
+ catch (error) {
123
+ throw AuthError.fromError(error, AuthProvider.GOOGLE);
124
+ }
125
+ }
88
126
  async getCurrentUser() {
89
127
  try {
90
- const user = await CapacitorAuthManager.getCurrentUser();
128
+ const raw = (await CapacitorAuthManager.getCurrentUser());
129
+ // A Capacitor call cannot resolve `null`; the native side answers `{}` when nobody is signed
130
+ // in. Treat anything without a string `uid` as "no user" — otherwise the empty object was
131
+ // taken as a user and the app restored an authenticated state with no account behind it.
132
+ const user = raw && typeof raw.uid === 'string' && raw.uid.length > 0
133
+ ? raw
134
+ : null;
91
135
  this.currentUser = user;
92
136
  return user;
93
137
  }
@@ -1,5 +1,5 @@
1
- import { AuthResult, SignInOptions, AuthErrorCode, AuthCredential, RefreshTokenOptions, AuthUser } from '../definitions';
2
- import { BaseAuthProvider } from './base-provider';
1
+ import { AuthResult, SignInOptions, AuthErrorCode, AuthCredential, RefreshTokenOptions, AuthUser } from '../definitions.js';
2
+ import { BaseAuthProvider } from './base-provider.js';
3
3
  export interface OAuthTokenResponse {
4
4
  access_token: string;
5
5
  token_type: string;
@@ -1,6 +1,6 @@
1
- import { AuthErrorCode, } from '../definitions';
2
- import { BaseAuthProvider } from './base-provider';
3
- import { AuthError } from '../utils/auth-error';
1
+ import { AuthErrorCode, } from '../definitions.js';
2
+ import { BaseAuthProvider } from './base-provider.js';
3
+ import { AuthError } from '../utils/auth-error.js';
4
4
  export class OAuthProvider extends BaseAuthProvider {
5
5
  async performOAuthFlow(options) {
6
6
  const config = this.getOAuthConfig();
@@ -1,8 +1,8 @@
1
- import { AuthProviderConfig, AuthPersistence } from '../definitions';
2
- import { BaseAuthProvider } from './base-provider';
3
- import { AuthProviderInterface } from '../core/types';
4
- import { StorageInterface } from '../utils/storage';
5
- import { Logger } from '../utils/logger';
1
+ import { AuthProviderConfig, AuthPersistence } from '../definitions.js';
2
+ import { BaseAuthProvider } from './base-provider.js';
3
+ import { AuthProviderInterface } from '../core/types.js';
4
+ import { StorageInterface } from '../utils/storage.js';
5
+ import { Logger } from '../utils/logger.js';
6
6
  export type AnyAuthProvider = BaseAuthProvider | AuthProviderInterface;
7
7
  /**
8
8
  * Legacy web-bridge factory (used by `CapacitorAuthManagerWeb` in `src/web.ts`).
@@ -1,5 +1,5 @@
1
- import { AuthProvider, } from '../definitions';
2
- import { GoogleAuthProviderWeb } from './web/google-provider';
1
+ import { AuthProvider, } from '../definitions.js';
2
+ import { GoogleAuthProviderWeb } from './web/google-provider.js';
3
3
  /**
4
4
  * Legacy web-bridge factory (used by `CapacitorAuthManagerWeb` in `src/web.ts`).
5
5
  *
@@ -1,5 +1,5 @@
1
- import { SignInOptions, SignOutOptions, RefreshTokenOptions, AuthResult } from '../../definitions';
2
- import { BaseAuthProvider, BaseProviderConfig } from '../base-provider';
1
+ import { SignInOptions, SignOutOptions, RefreshTokenOptions, AuthResult } from '../../definitions.js';
2
+ import { BaseAuthProvider } from '../base-provider.js';
3
3
  interface GoogleCredentialResponse {
4
4
  credential?: string;
5
5
  select_by?: string;
@@ -37,11 +37,43 @@ interface GoogleIdApi {
37
37
  error?: string;
38
38
  }) => void) => void;
39
39
  }
40
+ interface GoogleTokenResponse {
41
+ access_token?: string;
42
+ expires_in?: string | number;
43
+ scope?: string;
44
+ token_type?: string;
45
+ error?: string;
46
+ error_description?: string;
47
+ }
48
+ interface GoogleTokenClientConfig {
49
+ client_id: string;
50
+ scope: string;
51
+ callback: (response: GoogleTokenResponse) => void;
52
+ error_callback?: (error: {
53
+ type?: string;
54
+ message?: string;
55
+ }) => void;
56
+ prompt?: '' | 'none' | 'consent' | 'select_account';
57
+ hint?: string;
58
+ hosted_domain?: string;
59
+ include_granted_scopes?: boolean;
60
+ }
61
+ interface GoogleTokenClient {
62
+ requestAccessToken: (overrides?: {
63
+ prompt?: string;
64
+ hint?: string;
65
+ }) => void;
66
+ }
67
+ interface GoogleOAuth2Api {
68
+ initTokenClient: (config: GoogleTokenClientConfig) => GoogleTokenClient;
69
+ revoke: (accessToken: string, callback?: () => void) => void;
70
+ }
40
71
  declare global {
41
72
  interface Window {
42
73
  google?: {
43
74
  accounts: {
44
75
  id: GoogleIdApi;
76
+ oauth2?: GoogleOAuth2Api;
45
77
  };
46
78
  };
47
79
  }
@@ -49,16 +81,23 @@ declare global {
49
81
  /**
50
82
  * Web Google provider — the implementation the registry loads on **web / electron**.
51
83
  *
52
- * Uses the **Google Identity Services ID-token flow** (`google.accounts.id`): no client secret, no
53
- * backend, no popup-blocker problems. The browser returns a Google **ID token** (JWT) which is
54
- * surfaced as `result.credential.idToken` — the SAME field the native providers populate — so the
55
- * Firebase handoff is identical on every platform:
84
+ * Two Google Identity Services flows are available, selected by {@link GoogleAuthOptions.webFlow}
85
+ * (default `'auto'`):
56
86
  *
57
- * await signInWithCredential(getAuth(), GoogleAuthProvider.credential(result.credential.idToken));
87
+ * 1. **One-Tap / FedCM id-token flow** (`google.accounts.id`): returns a Google **ID token** (JWT) as
88
+ * `result.credential.idToken` — the same field the native providers populate.
89
+ * 2. **OAuth2 popup flow** (`google.accounts.oauth2.initTokenClient`): a deterministic popup that works
90
+ * from any click handler and returns an **access token** as `result.credential.accessToken`; the user
91
+ * profile is read from Google's `userinfo` endpoint. `'auto'` falls back to this whenever the browser
92
+ * does not display One-Tap (cooldown, FedCM opt-out, third-party-cookie settings).
58
93
  *
59
- * The id-token flow does NOT return an OAuth `accessToken` (use the GIS token client separately if you
60
- * need to call Google APIs from the browser). Sign-in is triggered via One-Tap / FedCM `prompt()`; for a
61
- * guaranteed button UX call {@link renderButton} to render Google's official button (same callback).
94
+ * Either credential is accepted by Firebase — the handoff is identical on every platform:
95
+ *
96
+ * const { idToken, accessToken } = result.credential;
97
+ * await signInWithCredential(getAuth(), GoogleAuthProvider.credential(idToken ?? null, accessToken));
98
+ *
99
+ * Neither flow needs a client secret or a backend. For Google's official button call
100
+ * {@link renderButton}; it shares the One-Tap credential callback.
62
101
  */
63
102
  export declare class GoogleAuthProviderWeb extends BaseAuthProvider {
64
103
  private loadPromise;
@@ -66,31 +105,48 @@ export declare class GoogleAuthProviderWeb extends BaseAuthProvider {
66
105
  private pendingResolve;
67
106
  private pendingReject;
68
107
  private currentNonce?;
69
- constructor(config: BaseProviderConfig);
108
+ /** Last credential issued in this page session (tokens are deliberately not persisted). */
109
+ private lastCredential;
110
+ private signingIn;
111
+ private pendingTimer;
112
+ private requestRevision;
113
+ private pendingPopupReject;
114
+ constructor(config?: unknown);
70
115
  get name(): string;
71
116
  initialize(): Promise<void>;
72
- signIn(_options?: SignInOptions): Promise<AuthResult>;
117
+ signIn(options?: SignInOptions): Promise<AuthResult>;
73
118
  /**
74
- * Renders Google's official "Sign in with Google" button into `parent`. Use this when One-Tap is
75
- * suppressed or you want a deterministic button. The button uses the SAME credential callback, so a
76
- * click resolves the most recent (or next) {@link signIn} promise with the ID-token credential.
119
+ * Renders Google's official "Sign in with Google" button into `parent`. Use this when you want
120
+ * Google's branded button rather than your own. It uses the SAME credential callback, so a click
121
+ * resolves the most recent (or next) {@link signIn} promise with the ID-token credential.
77
122
  */
78
123
  renderButton(parent: HTMLElement, options?: Record<string, unknown>): Promise<void>;
79
124
  signOut(_options?: SignOutOptions): Promise<void>;
80
125
  /**
81
- * Web ID tokens cannot be refreshed silently — re-running One-Tap (with auto-select) re-issues a
82
- * fresh ID token for a returning user. Falls back to a normal prompt if auto-select can't.
126
+ * Web tokens cannot be refreshed silently without a backend — re-running the configured flow
127
+ * (One-Tap auto-select for a returning user, or the popup) re-issues a fresh credential.
83
128
  */
84
129
  refreshToken(_options?: RefreshTokenOptions): Promise<AuthResult>;
130
+ /**
131
+ * Returns the ID token from the current page session. `forceRefresh` (or an expired token) re-runs
132
+ * One-Tap. Throws `NO_AUTH_SESSION` when the last sign-in was the popup flow, which issues no ID token.
133
+ */
134
+ getIdToken(forceRefresh?: boolean): Promise<string>;
85
135
  revokeAccess(token?: string): Promise<void>;
86
136
  isSupported(): Promise<boolean>;
137
+ private signInWithOneTap;
138
+ private handleCredential;
139
+ private signInWithPopup;
140
+ private fetchUserInfo;
141
+ private requireClientId;
87
142
  private requireIdApi;
88
143
  private configureIdClient;
89
- private handleCredential;
90
144
  private validateIdToken;
91
145
  private buildUser;
92
146
  private resolvePending;
93
147
  private rejectPending;
148
+ private clearPendingTimer;
149
+ dispose(): void;
94
150
  private loadGsi;
95
151
  }
96
152
  export {};