forked from clerk/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
28 lines (25 loc) · 996 Bytes
/
Copy pathtypes.ts
File metadata and controls
28 lines (25 loc) · 996 Bytes
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
import type { AuthObject, createClerkClient } from '@clerk/backend';
import type { AuthenticateRequestOptions } from '@clerk/backend/internal';
import type { Request as ExpressRequest } from 'express';
export type ExpressRequestWithAuth = ExpressRequest & { auth: AuthObject };
export type ClerkMiddlewareOptions = AuthenticateRequestOptions & {
debug?: boolean;
clerkClient?: ClerkClient;
/**
* Enables Clerk's handshake flow, which helps verify the session state
* when a session JWT has expired. It issues a 307 redirect to refresh
* the session JWT if the user is still logged in.
*
* This is useful for server-rendered fullstack applications to handle
* expired JWTs securely and maintain session continuity.
*
* @default true
*/
enableHandshake?: boolean;
};
type ClerkClient = ReturnType<typeof createClerkClient>;
export type AuthenticateRequestParams = {
clerkClient: ClerkClient;
request: ExpressRequest;
options?: ClerkMiddlewareOptions;
};