Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

496 B
Raw Blame
import { AgentRuntimeError } from '@lobechat/model-runtime';
import { ChatErrorType } from '@lobechat/types';

interface CheckAuthParams {
  betterAuthAuthorized?: boolean;
}

/**
 * Check if authentication is valid.
 * Only accepts a verified server-side session (Better Auth).
 */
export const checkAuthMethod = (params: CheckAuthParams) => {
  const { betterAuthAuthorized } = params;

  if (betterAuthAuthorized) return;

  throw AgentRuntimeError.createError(ChatErrorType.Unauthorized);
};