feat: support real browser auth import
This commit is contained in:
@@ -491,6 +491,12 @@ export interface AuthCaptureSession {
|
||||
ws_url: string
|
||||
}
|
||||
|
||||
export interface BrowserImportSession {
|
||||
session_id: string
|
||||
secret: string
|
||||
expires_in_seconds: number
|
||||
}
|
||||
|
||||
export interface AuthCaptureCandidate {
|
||||
type: 'bearer_token' | 'cookie' | 'cookie_bundle' | 'credential' | 'api_key'
|
||||
source: string
|
||||
@@ -513,6 +519,13 @@ export interface AuthCaptureResult {
|
||||
candidates: AuthCaptureCandidate[]
|
||||
}
|
||||
|
||||
export interface BrowserImportStatus {
|
||||
session_id: string
|
||||
ready: boolean
|
||||
expires_at: number
|
||||
result: AuthCaptureResult | null
|
||||
}
|
||||
|
||||
export const authCaptureApi = {
|
||||
createSession: (url: string, width?: number, height?: number) =>
|
||||
api.post<AuthCaptureSession>('/api/auth-capture/sessions', { url, width, height }),
|
||||
@@ -522,6 +535,12 @@ export const authCaptureApi = {
|
||||
}),
|
||||
closeSession: (sessionId: string) =>
|
||||
api.delete(`/api/auth-capture/sessions/${sessionId}`),
|
||||
createImportSession: (targetUrl: string) =>
|
||||
api.post<BrowserImportSession>('/api/auth-capture/import-sessions', { target_url: targetUrl }),
|
||||
importSessionStatus: (sessionId: string, options?: { includeRaw?: boolean }) =>
|
||||
api.get<BrowserImportStatus>(`/api/auth-capture/import-sessions/${sessionId}`, {
|
||||
params: options?.includeRaw ? { include_raw: true } : undefined,
|
||||
}),
|
||||
wsUrl: (sessionId: string, token?: string) => {
|
||||
const proto = location.protocol === 'https:' ? 'wss:' : 'ws:'
|
||||
const params = new URLSearchParams()
|
||||
|
||||
Reference in New Issue
Block a user