Skip to content

Commit 2871241

Browse files
feat: add optional timeout prop to Auth0Provider for authentication requests (#1124)
1 parent e604173 commit 2871241

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.snyk

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ ignore:
1212
reason: This issue is temporarily ignored while we evaluate alternative dependencies or wait for an update from Expo/Metro.
1313
expires: 2025-04-12T09:15:05.191Z
1414
created: 2025-03-12T09:15:05.191Z
15+
SNYK-JS-IMAGESIZE-9634164:
16+
- '*':
17+
reason: This issue is temporarily ignored untill there is a new release of react native fixed this issue.
18+
expires: 2025-05-12T09:15:05.191Z
19+
created: 2025-04-07T09:15:05.191Z
1520
snyk:lic:npm:lightningcss-win32-x64-msvc:MPL-2.0:
1621
- '*':
1722
reason: This issue is temporarily ignored while we evaluate alternative dependencies or wait for an update from Expo/Metro.

src/hooks/auth0-provider.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ const finalizeScopeParam = (inputScopes?: string) => {
6161
* @param {String} domain Your Auth0 domain
6262
* @param {String} clientId Your Auth0 client ID
6363
* @param {LocalAuthenticationOptions} localAuthenticationOptions The local auth options
64+
* @param {number} timeout - Optional timeout in milliseconds for authentication requests.
65+
* @param {React.ReactNode} children - The child components to render within the provider.
6466
*
6567
* @example
6668
* ```ts
@@ -73,15 +75,17 @@ const Auth0Provider = ({
7375
domain,
7476
clientId,
7577
localAuthenticationOptions,
78+
timeout,
7679
children,
7780
}: PropsWithChildren<{
7881
domain: string;
7982
clientId: string;
8083
localAuthenticationOptions?: LocalAuthenticationOptions;
84+
timeout?: number;
8185
}>) => {
8286
const client = useMemo(
83-
() => new Auth0({ domain, clientId, localAuthenticationOptions }),
84-
[domain, clientId, localAuthenticationOptions]
87+
() => new Auth0({ domain, clientId, localAuthenticationOptions, timeout }),
88+
[domain, clientId, localAuthenticationOptions, timeout]
8589
);
8690
const [state, dispatch] = useReducer(reducer, initialState);
8791

0 commit comments

Comments
 (0)