MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / clerkSignIn

Method clerkSignIn

packages/cloud/src/WebAuthService.ts:526–557  ·  view source on GitHub ↗
(ticket: string)

Source from the content-addressed store, hash-verified

524 }
525
526 private async clerkSignIn(ticket: string): Promise<AuthCredentials> {
527 const formData = new URLSearchParams()
528 formData.append("strategy", "ticket")
529 formData.append("ticket", ticket)
530
531 const response = await fetch(`${getClerkBaseUrl()}/v1/client/sign_ins`, {
532 method: "POST",
533 headers: {
534 "Content-Type": "application/x-www-form-urlencoded",
535 "User-Agent": this.userAgent(),
536 },
537 body: formData.toString(),
538 signal: AbortSignal.timeout(10000),
539 })
540
541 if (!response.ok) {
542 throw new Error(`HTTP ${response.status}: ${response.statusText}`)
543 }
544
545 const {
546 response: { created_session_id: sessionId },
547 } = clerkSignInResponseSchema.parse(await response.json())
548
549 // 3. Extract the client token from the Authorization header.
550 const clientToken = response.headers.get("authorization")
551
552 if (!clientToken) {
553 throw new Error("No authorization header found in the response")
554 }
555
556 return authCredentialsSchema.parse({ clientToken, sessionId })
557 }
558
559 private async clerkCreateSessionToken(): Promise<string> {
560 const formData = new URLSearchParams()

Callers 1

handleCallbackMethod · 0.95

Calls 6

userAgentMethod · 0.95
getClerkBaseUrlFunction · 0.85
parseMethod · 0.80
toStringMethod · 0.65
getMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected