Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

feat(recipe-studio): add authentication to API requests and backend routes

Shine1idf553fc955aa
diff --git a/studio/backend/routes/data_recipe/__init__.py b/studio/backend/routes/data_recipe/__init__.py
index dc0301d1c98..0d3f4febf9d 100644
--- a/studio/backend/routes/data_recipe/__init__.py
+++ b/studio/backend/routes/data_recipe/__init__.py
@@ -5,7 +5,9 @@ from __future__ import annotations
import sys
from pathlib import Path
-from fastapi import APIRouter
+from fastapi import APIRouter, Depends
+
+from auth.authentication import get_current_subject
backend_path = Path(__file__).parent.parent.parent
if str(backend_path) not in sys.path:
@@ -15,7 +17,7 @@ from .jobs import router as jobs_router
from .seed import router as seed_router
from .validate import router as validate_router
-router = APIRouter()
+router = APIRouter(dependencies=[Depends(get_current_subject)])
router.include_router(seed_router)
router.include_router(validate_router)
router.include_router(jobs_router)
diff --git a/studio/frontend/src/features/recipe-studio/api/index.ts b/studio/frontend/src/features/recipe-studio/api/index.ts
index 1b3c186659a..c1d4174feb2 100644
--- a/studio/frontend/src/features/recipe-studio/api/index.ts
+++ b/studio/frontend/src/features/recipe-studio/api/index.ts
@@ -1,3 +1,5 @@
+import { authFetch } from "@/features/auth";
+
const DEFAULT_BASE = "/api/data-recipe";
export const DATA_DESIGNER_API_BASE =
@@ -146,7 +148,7 @@ async function parseErrorResponse(response: Response): Promise<string> {
}
async function postJson<T>(path: string, payload: unknown): Promise<T> {
- const response = await fetch(`${DATA_DESIGNER_API_BASE}${path}`, {
+ const response = await authFetch(`${DATA_DESIGNER_API_BASE}${path}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -162,7 +164,7 @@ async function postJson<T>(path: string, payload: unknown): Promise<T> {
}
async function getJson<T>(path: string): Promise<T> {
- const response = await fetch(`${DATA_DESIGNER_API_BASE}${path}`);
+ const response = await authFetch(`${DATA_DESIGNER_API_BASE}${path}`);
if (!response.ok) {
throw new Error(await parseErrorResponse(response));
}
@@ -273,7 +275,7 @@ export async function streamRecipeJobEvents(options: {
query = `?after=${options.lastEventId}`;
}
- const response = await fetch(
+ const response = await authFetch(
`${DATA_DESIGNER_API_BASE}/jobs/${options.jobId}/events${query}`,
{
method: "GET",
diff --git a/studio/frontend/src/features/recipe-studio/components/executions/execution-sidebar.tsx b/studio/frontend/src/features/recipe-studio/components/executions/execution-sidebar.tsx
index f5e3c245703..aed43d75b49 100644
--- a/studio/frontend/src/features/recipe-studio/components/executions/execution-sidebar.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/executions/execution-sidebar.tsx
@@ -23,7 +23,7 @@ export function ExecutionSidebar({
}: ExecutionSidebarProps): ReactElement {
return (
<aside className="w-72 shrink-0 border-r border-border/60 bg-card/20">
- <div className="flex items-center justify-between border-b border-border/60 px-3 py-2">
+ <div className="flex items-center justify-between border-border/60 px-3 py-2">
<p className="text-xs font-semibold uppercase text-muted-foreground">
Executions
</p>
diff --git a/studio/frontend/src/features/recipe-studio/components/executions/executions-view.tsx b/studio/frontend/src/features/recipe-studio/components/executions/executions-view.tsx
index c62ec41de9a..e9a2a12f853 100644
--- a/studio/frontend/src/features/recipe-studio/components/executions/executions-view.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/executions/executions-view.tsx
@@ -336,7 +336,7 @@ export function ExecutionsView({
) : (
<div className="space-y-4">
{showProgressPanel && (
- <div className="space-y-3 rounded-2xl border border-border/60 bg-card/55 p-3">
+ <div className="space-y-3 rounded-2xl border shadow-border border-border/60 bg-card/55 p-3">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<HugeiconsIcon