Skip to content

Commit b4c4e9f

Browse files
committed
refactor!: rename androidNetworkingOptions to networkingOptions
Every other platform-specific option on Auth0Options (maxRetries, credentialsManagerStorageKey) documents its platform restriction via @remarks rather than baking the platform name into the identifier. androidNetworkingOptions was the one exception. Since v6 hasn't shipped yet, rename it now while it's free, ahead of adding iOS networking config under its own umbrella later.
1 parent 6f81aa7 commit b4c4e9f

13 files changed

Lines changed: 43 additions & 43 deletions

File tree

EXAMPLES.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,10 @@ function MyComponent() {
644644
645645
> **Platform Support:** Android only. Accepted on iOS for API compatibility but has no effect.
646646
647-
The `androidNetworkingOptions` configuration option lets you tune the native networking client (`DefaultClient` from Auth0.Android's OkHttp-based stack) used for every request the native SDK makes on your behalf — web auth token exchange, credential renewal, MFA, passkeys, and My Account API calls.
647+
The `networkingOptions` configuration option lets you tune the native networking client (`DefaultClient` from Auth0.Android's OkHttp-based stack) used for every request the native SDK makes on your behalf — web auth token exchange, credential renewal, MFA, passkeys, and My Account API calls.
648648
649649
```ts
650-
androidNetworkingOptions?: {
650+
networkingOptions?: {
651651
connectTimeout?: number; // seconds, default 10
652652
readTimeout?: number; // seconds, default 10
653653
writeTimeout?: number; // seconds, default 10
@@ -673,7 +673,7 @@ function App() {
673673
<Auth0Provider
674674
domain="YOUR_AUTH0_DOMAIN"
675675
clientId="YOUR_AUTH0_CLIENT_ID"
676-
androidNetworkingOptions={{
676+
networkingOptions={{
677677
connectTimeout: 30,
678678
readTimeout: 30,
679679
defaultHeaders: { 'X-App-Version': '1.2.3' },
@@ -693,7 +693,7 @@ import Auth0 from 'react-native-auth0';
693693
const auth0 = new Auth0({
694694
domain: 'YOUR_AUTH0_DOMAIN',
695695
clientId: 'YOUR_AUTH0_CLIENT_ID',
696-
androidNetworkingOptions: {
696+
networkingOptions: {
697697
connectTimeout: 30,
698698
readTimeout: 30,
699699
},

android/src/main/java/com/auth0/react/A0Auth0Module.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ class A0Auth0Module(private val reactContext: ReactApplicationContext) : A0Auth0
9393
// config, so this always resolves to a fresh DefaultClient() when options are absent
9494
// rather than leaving the previous networkingClient in place.
9595
internal fun resolveNetworkingClient(
96-
androidNetworkingOptions: ReadableMap?,
96+
networkingOptions: ReadableMap?,
9797
isDebuggable: Boolean
9898
): DefaultClient =
99-
androidNetworkingOptions?.let { buildNetworkingClient(it, isDebuggable) } ?: DefaultClient()
99+
networkingOptions?.let { buildNetworkingClient(it, isDebuggable) } ?: DefaultClient()
100100
}
101101

102102
private val errorCodeMap = mapOf(
@@ -315,7 +315,7 @@ class A0Auth0Module(private val reactContext: ReactApplicationContext) : A0Auth0
315315
useDPoP: Boolean?,
316316
maxRetries: Double,
317317
credentialsManagerStorageKey: String?,
318-
androidNetworkingOptions: ReadableMap?,
318+
networkingOptions: ReadableMap?,
319319
promise: Promise
320320
) {
321321
// Note: maxRetries parameter is ignored on Android as the Auth0.Android SDK
@@ -326,7 +326,7 @@ class A0Auth0Module(private val reactContext: ReactApplicationContext) : A0Auth0
326326
val auth0Instance = Auth0.getInstance(clientId, domain)
327327
auth0 = auth0Instance
328328
val isDebuggable = (reactContext.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE) != 0
329-
auth0Instance.networkingClient = resolveNetworkingClient(androidNetworkingOptions, isDebuggable)
329+
auth0Instance.networkingClient = resolveNetworkingClient(networkingOptions, isDebuggable)
330330
mfaClient = MfaClient(auth0Instance, this.useDPoP, reactContext)
331331
myAccount = MyAccount(auth0Instance, this.useDPoP, reactContext)
332332
passwordless = Passwordless(auth0Instance, this.useDPoP, reactContext)

android/src/test/java/com/auth0/react/A0Auth0ModuleNetworkingOptionsTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import java.io.IOException
1414
import java.util.concurrent.TimeUnit
1515
import kotlin.system.measureTimeMillis
1616

17-
// Proves that A0Auth0Module.buildNetworkingClient() genuinely threads androidNetworkingOptions
17+
// Proves that A0Auth0Module.buildNetworkingClient() genuinely threads networkingOptions
1818
// into the DefaultClient it builds, rather than just compiling. Exercises the client against a
1919
// real (local) server so the OkHttp timeout machinery actually runs.
2020
class A0Auth0ModuleNetworkingOptionsTest {
@@ -33,7 +33,7 @@ class A0Auth0ModuleNetworkingOptionsTest {
3333
}
3434

3535
@Test
36-
fun `readTimeout from androidNetworkingOptions is applied to the built DefaultClient`() {
36+
fun `readTimeout from networkingOptions is applied to the built DefaultClient`() {
3737
val configuredTimeoutSeconds = 1
3838
// Stall the response well past the configured timeout.
3939
server.enqueue(MockResponse().setHeadersDelay(3, TimeUnit.SECONDS).setBody("{}"))
@@ -62,7 +62,7 @@ class A0Auth0ModuleNetworkingOptionsTest {
6262
}
6363

6464
@Test
65-
fun `defaultHeaders from androidNetworkingOptions are sent on every request`() {
65+
fun `defaultHeaders from networkingOptions are sent on every request`() {
6666
server.enqueue(MockResponse().setBody("{}"))
6767

6868
val client = A0Auth0Module.buildNetworkingClient(
@@ -103,7 +103,7 @@ class A0Auth0ModuleNetworkingOptionsTest {
103103
isDebuggable = true
104104
)
105105

106-
// Re-initialization with the same clientId/domain but androidNetworkingOptions omitted
106+
// Re-initialization with the same clientId/domain but networkingOptions omitted
107107
// must not carry the previous readTimeout forward - it should behave like a fresh
108108
// DefaultClient() (10s default readTimeout).
109109
val reset = A0Auth0Module.resolveNetworkingClient(null, isDebuggable = true)

ios/A0Auth0.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ - (dispatch_queue_t)methodQueue
100100
useDPoP:(nonnull NSNumber *)useDPoP
101101
maxRetries:(double)maxRetries
102102
credentialsManagerStorageKey:(NSString * _Nullable)credentialsManagerStorageKey
103-
androidNetworkingOptions:(NSDictionary * _Nullable)androidNetworkingOptions
103+
networkingOptions:(NSDictionary * _Nullable)networkingOptions
104104
resolve:(RCTPromiseResolveBlock)resolve
105105
reject:(RCTPromiseRejectBlock)reject) {
106-
// androidNetworkingOptions is Android-only; intentionally not forwarded to NativeBridge.
106+
// networkingOptions is Android-only; intentionally not forwarded to NativeBridge.
107107
[self tryAndInitializeNativeBridge:clientId domain:domain withLocalAuthenticationOptions:localAuthenticationOptions useDPoP:useDPoP maxRetries:(NSInteger)maxRetries credentialsManagerStorageKey:credentialsManagerStorageKey resolve:resolve reject:reject];
108108
}
109109

src/core/utils/__tests__/configSignature.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,28 +85,28 @@ describe('getConfigSignature', () => {
8585
);
8686
});
8787

88-
it('differs when androidNetworkingOptions changes', () => {
88+
it('differs when networkingOptions changes', () => {
8989
expect(
9090
getConfigSignature({
9191
...base,
92-
androidNetworkingOptions: { connectTimeout: 10 },
92+
networkingOptions: { connectTimeout: 10 },
9393
})
9494
).not.toBe(
9595
getConfigSignature({
9696
...base,
97-
androidNetworkingOptions: { connectTimeout: 30 },
97+
networkingOptions: { connectTimeout: 30 },
9898
})
9999
);
100100
});
101101

102-
it('is insensitive to androidNetworkingOptions key order', () => {
102+
it('is insensitive to networkingOptions key order', () => {
103103
const a = getConfigSignature({
104104
...base,
105-
androidNetworkingOptions: { connectTimeout: 10, readTimeout: 20 },
105+
networkingOptions: { connectTimeout: 10, readTimeout: 20 },
106106
});
107107
const b = getConfigSignature({
108108
...base,
109-
androidNetworkingOptions: { readTimeout: 20, connectTimeout: 10 },
109+
networkingOptions: { readTimeout: 20, connectTimeout: 10 },
110110
});
111111
expect(a).toBe(b);
112112
});

src/core/utils/configSignature.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const SIGNIFICANT_KEYS = [
99
'useDPoP',
1010
'maxRetries',
1111
'credentialsManagerStorageKey',
12-
'androidNetworkingOptions',
12+
'networkingOptions',
1313
] as const satisfies ReadonlyArray<keyof Auth0Options>;
1414

1515
// Stable, order-independent identity string for a config: keys the factory cache, the provider memo, and the native re-init decision. Object values are sorted so key order doesn't matter.

src/platforms/native/adapters/NativeAuth0Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class NativeAuth0Client implements Auth0Client {
109109
useDPoP = false,
110110
maxRetries,
111111
credentialsManagerStorageKey,
112-
androidNetworkingOptions,
112+
networkingOptions,
113113
} = options;
114114
// Re-init when domain/clientId differ (hasValidInstance) or any other
115115
// identity option drifted from what was last applied to the native side.
@@ -127,7 +127,7 @@ export class NativeAuth0Client implements Auth0Client {
127127
useDPoP,
128128
maxRetries,
129129
credentialsManagerStorageKey,
130-
androidNetworkingOptions
130+
networkingOptions
131131
);
132132
}
133133
// Record even on the skip path so siblings differing only in a

src/platforms/native/adapters/__tests__/NativeAuth0Client.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ describe('NativeAuth0Client', () => {
121121
false, // useDPoP defaults to false
122122
undefined, // maxRetries not provided
123123
undefined, // credentialsManagerStorageKey not provided
124-
undefined // androidNetworkingOptions not provided
124+
undefined // networkingOptions not provided
125125
);
126126

127127
// Use client to avoid unused variable warning
@@ -166,20 +166,20 @@ describe('NativeAuth0Client', () => {
166166
false, // useDPoP defaults to false
167167
undefined, // maxRetries not provided
168168
undefined, // credentialsManagerStorageKey not provided
169-
undefined // androidNetworkingOptions not provided
169+
undefined // networkingOptions not provided
170170
);
171171

172172
// Use client to avoid unused variable warning
173173
expect(client).toBeDefined();
174174
});
175175

176-
it('should pass androidNetworkingOptions to initialize when provided', async () => {
176+
it('should pass networkingOptions to initialize when provided', async () => {
177177
mockBridgeInstance.hasValidInstance.mockResolvedValue(false);
178-
const androidNetworkingOptions = { connectTimeout: 30, readTimeout: 30 };
178+
const networkingOptions = { connectTimeout: 30, readTimeout: 30 };
179179

180180
const client = new NativeAuth0Client({
181181
...options,
182-
androidNetworkingOptions,
182+
networkingOptions,
183183
});
184184
await new Promise(process.nextTick);
185185

@@ -190,7 +190,7 @@ describe('NativeAuth0Client', () => {
190190
false,
191191
undefined,
192192
undefined,
193-
androidNetworkingOptions
193+
networkingOptions
194194
);
195195

196196
expect(client).toBeDefined();

src/platforms/native/bridge/NativeBridge.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
MfaEnrollmentChallenge,
1010
MfaChallengeResult,
1111
PasskeyChallengeResponse,
12-
AndroidNetworkingOptions,
12+
NetworkingOptions,
1313
} from '../../../types';
1414
import type {
1515
LocalAuthenticationOptions,
@@ -40,7 +40,7 @@ export interface NativeBridge {
4040
* @param useDPoP Whether to enable DPoP (Demonstrating Proof-of-Possession) for token requests.
4141
* @param maxRetries The maximum number of retry attempts for transient errors during credential renewal. **iOS only** - ignored on Android. Defaults to 0.
4242
* @param credentialsManagerStorageKey Namespaces the credentials store. **Android only** SharedPreferences file name. **iOS only** Keychain service name. Defaults to the shared store when omitted.
43-
* @param androidNetworkingOptions Configures the native networking client. **Android only** - ignored on iOS.
43+
* @param networkingOptions Configures the native networking client. **Android only** - ignored on iOS.
4444
*/
4545
initialize(
4646
clientId: string,
@@ -49,7 +49,7 @@ export interface NativeBridge {
4949
useDPoP?: boolean,
5050
maxRetries?: number,
5151
credentialsManagerStorageKey?: string,
52-
androidNetworkingOptions?: AndroidNetworkingOptions
52+
networkingOptions?: NetworkingOptions
5353
): Promise<void>;
5454

5555
/**

src/platforms/native/bridge/NativeBridgeManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {
1111
MfaEnrollmentChallenge,
1212
MfaChallengeResult,
1313
PasskeyChallengeResponse,
14-
AndroidNetworkingOptions,
14+
NetworkingOptions,
1515
} from '../../../types';
1616
import {
1717
SafariViewControllerPresentationStyle,
@@ -62,7 +62,7 @@ export class NativeBridgeManager implements NativeBridge {
6262
useDPoP: boolean = false,
6363
maxRetries: number = 0,
6464
credentialsManagerStorageKey?: string,
65-
androidNetworkingOptions?: AndroidNetworkingOptions
65+
networkingOptions?: NetworkingOptions
6666
): Promise<void> {
6767
// This is a new method we'd add to the native side to ensure the
6868
// underlying Auth0.swift/Auth0.android SDKs are configured.
@@ -76,7 +76,7 @@ export class NativeBridgeManager implements NativeBridge {
7676
useDPoP,
7777
maxRetries,
7878
credentialsManagerStorageKey,
79-
androidNetworkingOptions
79+
networkingOptions
8080
);
8181
}
8282

0 commit comments

Comments
 (0)