import type { createAuthClient } from "better-auth/react"; type AuthClient = ReturnType; type OAuth2SignIn = (input: { providerId: string; callbackURL: string; }) => Promise<{ error?: { message?: string } | null }>; export async function signInWithAuthentik(authClient: AuthClient, callbackURL: string) { return (authClient.signIn as unknown as { oauth2: OAuth2SignIn }).oauth2({ providerId: "authentik", callbackURL, }); }