-
Notifications
You must be signed in to change notification settings - Fork 453
Expand file tree
/
Copy pathtypes.ts
More file actions
45 lines (42 loc) · 1.3 KB
/
types.ts
File metadata and controls
45 lines (42 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import type { ClerkOptions } from '@clerk/backend';
import type { ShouldProxyFn } from '@clerk/shared/proxy';
export const ALLOWED_HOOKS = ['onRequest', 'preHandler'] as const;
/**
* Options for configuring Frontend API proxy in clerkPlugin
*/
export interface FrontendApiProxyOptions {
/**
* Enable proxy handling. Can be:
* - `true` - enable for all domains
* - `false` - disable for all domains
* - A function: (url: URL) => boolean - enable based on the request URL
*/
enabled: boolean | ShouldProxyFn;
/**
* The path prefix for proxy requests.
*
* @default '/__clerk'
*/
path?: string;
}
export type ClerkFastifyOptions = ClerkOptions & {
hookName?: (typeof ALLOWED_HOOKS)[number];
/**
* Configure Frontend API proxy handling. When set, requests to the proxy path
* will skip authentication, and the proxyUrl will be automatically derived
* for handshake redirects.
*
* @example
* // Enable with defaults (path: '/__clerk')
* clerkPlugin({ frontendApiProxy: { enabled: true } })
*
* @example
* // Custom path
* clerkPlugin({ frontendApiProxy: { enabled: true, path: '/my-proxy' } })
*
* @example
* // Disable proxy handling
* clerkPlugin({ frontendApiProxy: { enabled: false } })
*/
frontendApiProxy?: FrontendApiProxyOptions;
};