Skip to content

Commit f4cff13

Browse files
author
renkelvin
committed
Make Auth.initializeRecaptchaConfig() internal
1 parent 26de963 commit f4cff13

File tree

5 files changed

+4
-52
lines changed

5 files changed

+4
-52
lines changed

common/api-review/auth.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export interface Auth {
8585
readonly config: Config;
8686
readonly currentUser: User | null;
8787
readonly emulatorConfig: EmulatorConfig | null;
88-
initializeRecaptchaConfig(): Promise<void>;
8988
languageCode: string | null;
9089
readonly name: string;
9190
onAuthStateChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;

docs-devsite/auth.auth.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export interface Auth
3838
| Method | Description |
3939
| --- | --- |
4040
| [beforeAuthStateChanged(callback, onAbort)](./auth.auth.md#authbeforeauthstatechanged) | Adds a blocking callback that runs before an auth state change sets a new user. |
41-
| [initializeRecaptchaConfig()](./auth.auth.md#authinitializerecaptchaconfig) | Loads the reCAPTCHA configuration into the <code>Auth</code> instance. |
4241
| [onAuthStateChanged(nextOrObserver, error, completed)](./auth.auth.md#authonauthstatechanged) | Adds an observer for changes to the user's sign-in state. |
4342
| [onIdTokenChanged(nextOrObserver, error, completed)](./auth.auth.md#authonidtokenchanged) | Adds an observer for changes to the signed-in user's ID token. |
4443
| [setPersistence(persistence)](./auth.auth.md#authsetpersistence) | Changes the type of persistence on the <code>Auth</code> instance. |
@@ -166,33 +165,6 @@ beforeAuthStateChanged(callback: (user: User | null) => void | Promise<void>, on
166165

167166
[Unsubscribe](./util.md#unsubscribe)
168167

169-
## Auth.initializeRecaptchaConfig()
170-
171-
Loads the reCAPTCHA configuration into the `Auth` instance.
172-
173-
This will load the reCAPTCHA config, which indicates whether the reCAPTCHA verification flow should be triggered for each auth provider, into the current Auth session.
174-
175-
If initializeRecaptchaConfig() is not invoked, the auth flow will always start without reCAPTCHA verification. If the provider is configured to require reCAPTCHA verification, the SDK will transparently load the reCAPTCHA config and restart the auth flows.
176-
177-
Thus, by calling this optional method, you will reduce the latency of future auth flows. Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA.
178-
179-
<b>Signature:</b>
180-
181-
```typescript
182-
initializeRecaptchaConfig(): Promise<void>;
183-
```
184-
<b>Returns:</b>
185-
186-
Promise&lt;void&gt;
187-
188-
### Example
189-
190-
191-
```javascript
192-
auth.initializeRecaptchaConfig();
193-
194-
```
195-
196168
## Auth.onAuthStateChanged()
197169

198170
Adds an observer for changes to the user's sign-in state.

packages/auth/src/core/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
ErrorFn,
2626
Unsubscribe
2727
} from '../model/public_types';
28+
import { _castAuth } from '../core/auth/auth_impl';
2829

2930
export {
3031
debugErrorMap,
@@ -87,7 +88,8 @@ export function setPersistence(
8788
* @public
8889
*/
8990
export function initializeRecaptchaConfig(auth: Auth): Promise<void> {
90-
return getModularInstance(auth).initializeRecaptchaConfig();
91+
const authInternal = _castAuth(auth);
92+
return authInternal.initializeRecaptchaConfig();
9193
}
9294

9395
/**

packages/auth/src/model/auth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,5 @@ export interface AuthInternal extends Auth {
9797

9898
useDeviceLanguage(): void;
9999
signOut(): Promise<void>;
100+
initializeRecaptchaConfig(): Promise<void>;
100101
}

packages/auth/src/model/public_types.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -202,28 +202,6 @@ export interface Auth {
202202
* @param persistence - The {@link Persistence} to use.
203203
*/
204204
setPersistence(persistence: Persistence): Promise<void>;
205-
/**
206-
* Loads the reCAPTCHA configuration into the `Auth` instance.
207-
*
208-
* @remarks
209-
* This will load the reCAPTCHA config, which indicates whether the reCAPTCHA
210-
* verification flow should be triggered for each auth provider, into the
211-
* current Auth session.
212-
*
213-
* If initializeRecaptchaConfig() is not invoked, the auth flow will always start
214-
* without reCAPTCHA verification. If the provider is configured to require reCAPTCHA
215-
* verification, the SDK will transparently load the reCAPTCHA config and restart the
216-
* auth flows.
217-
*
218-
* Thus, by calling this optional method, you will reduce the latency of future auth flows.
219-
* Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA.
220-
*
221-
* @example
222-
* ```javascript
223-
* auth.initializeRecaptchaConfig();
224-
* ```
225-
*/
226-
initializeRecaptchaConfig(): Promise<void>;
227205
/**
228206
* The {@link Auth} instance's language code.
229207
*

0 commit comments

Comments
 (0)