async function handleVerify()

in app/routes/api.auth.tsx [180:216]


async function handleVerify(request: Request) {
  const cookieHeader = request.headers.get("Cookie");
  if (!cookieHeader) {
    return json({
      isAuthenticated: false,
      hasOpenAI: false,
      hasHuggingFace: false,
      hasGitHub: false,
    });
  }

  // Use the improved credential extraction logic
  const credentials = extractCredentialsFromCookie(cookieHeader);

  // Check if the user has valid credentials (HF or GitHub in Docker mode)
  const isAuthenticated = hasValidCredentials(credentials);
  const hasGitHub = hasGitHubCredentials(credentials);
  const hasHuggingFace = !!credentials.huggingfaceToken;

  if (!isAuthenticated) {
    return json({
      isAuthenticated: false,
      hasOpenAI: false,
      hasHuggingFace: false,
      hasGitHub: false,
    });
  }

  return json({
    isAuthenticated: true,
    hasOpenAI: false, // OpenAI is handled as a regular secret now
    hasHuggingFace,
    hasGitHub,
    hfUserInfo: credentials.hfUserInfo,
    githubUserInfo: credentials.githubUserInfo,
  });
}