UNPKG

@builder.io/qwik-auth

Version:

Qwik Auth is powered by Auth.js, a battle tested library for authentication with 3rd party providers

87 lines (86 loc) 3.19 kB
import type { AuthConfig } from '@auth/core'; import type { Session } from '@auth/core/types'; import { type QRL } from '@builder.io/qwik'; import { z, type RequestEvent, type RequestEventCommon } from '@builder.io/qwik-city'; export type GetSessionResult = Promise<{ data: Session | null; cookie: any; }>; export type QwikAuthConfig = AuthConfig; export declare function serverAuthQrl(authOptions: QRL<(ev: RequestEventCommon) => QwikAuthConfig>): { useAuthSignin: import("@builder.io/qwik-city").Action<{ formErrors?: undefined; fieldErrors?: undefined; failed?: undefined; } | { formErrors: string[]; fieldErrors: { options?: string[] | undefined; providerId?: string[] | undefined; callbackUrl?: string[] | undefined; authorizationParams?: string[] | undefined; }; failed: true; }, { providerId?: string | undefined; callbackUrl?: string | undefined; options?: z.objectOutputType<{ callbackUrl: z.ZodOptional<z.ZodString>; }, z.ZodTypeAny, "passthrough"> | undefined; authorizationParams?: string | URLSearchParams | Record<string, string> | undefined; }, false>; useAuthSignout: import("@builder.io/qwik-city").Action<{ formErrors?: undefined; fieldErrors?: undefined; failed?: undefined; } | { formErrors: string[]; fieldErrors: { callbackUrl?: string[] | undefined; }; failed: true; }, { callbackUrl?: string | undefined; }, false>; useAuthSession: import("@builder.io/qwik-city").Loader<Session | null>; onRequest: (req: RequestEvent) => Promise<void>; }; export declare const serverAuth$: (qrl: (ev: RequestEventCommon) => QwikAuthConfig) => { useAuthSignin: import("@builder.io/qwik-city").Action<{ formErrors?: undefined; fieldErrors?: undefined; failed?: undefined; } | { formErrors: string[]; fieldErrors: { options?: string[] | undefined; providerId?: string[] | undefined; callbackUrl?: string[] | undefined; authorizationParams?: string[] | undefined; }; failed: true; }, { providerId?: string | undefined; callbackUrl?: string | undefined; options?: z.objectOutputType<{ callbackUrl: z.ZodOptional<z.ZodString>; }, z.ZodTypeAny, "passthrough"> | undefined; authorizationParams?: string | URLSearchParams | Record<string, string> | undefined; }, false>; useAuthSignout: import("@builder.io/qwik-city").Action<{ formErrors?: undefined; fieldErrors?: undefined; failed?: undefined; } | { formErrors: string[]; fieldErrors: { callbackUrl?: string[] | undefined; }; failed: true; }, { callbackUrl?: string | undefined; }, false>; useAuthSession: import("@builder.io/qwik-city").Loader<Session | null>; onRequest: (req: RequestEvent) => Promise<void>; }; export declare const ensureAuthMiddleware: (req: RequestEvent) => void;