Skip to content

Commit 583c586

Browse files
cristipufuclaude
andcommitted
feat: add interactive OAuth authentication to dev server
Implements PKCE-based OAuth flow matching the Python SDK's `uipath auth` CLI command. A temporary callback server receives the token from the browser, resolves tenants, and writes credentials to .env and os.environ. Includes session persistence across restarts, automatic token expiry detection with re-auth support, and a configurable flag to disable auth in deployments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c92edac commit 583c586

File tree

19 files changed

+1619
-82
lines changed

19 files changed

+1619
-82
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ RUN chmod +x start.sh
99

1010
ENV UIPATH_DEV_SERVER_PORT=80
1111
ENV UIPATH_DEV_SERVER_HOST=0.0.0.0
12+
ENV UIPATH_AUTH_ENABLED=false
1213

1314
CMD ["/bin/sh", "/app/start.sh"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-dev"
3-
version = "0.0.56"
3+
version = "0.0.57"
44
description = "UiPath Developer Console"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/dev/server/app.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import logging
6+
import os
67
from pathlib import Path
78

89
from fastapi import FastAPI
@@ -129,13 +130,31 @@ async def _favicon_svg_route():
129130
# Store server reference on app state for route access
130131
app.state.server = server
131132

133+
auth_enabled = os.environ.get("UIPATH_AUTH_ENABLED", "true").lower() not in (
134+
"false",
135+
"0",
136+
"no",
137+
)
138+
139+
# Config endpoint — tells the frontend which features are available
140+
@app.get("/api/config", include_in_schema=False)
141+
async def _config():
142+
return {"auth_enabled": auth_enabled}
143+
132144
# Register routes
133145
from uipath.dev.server.routes.entrypoints import router as entrypoints_router
134146
from uipath.dev.server.routes.graph import router as graph_router
135147
from uipath.dev.server.routes.reload import router as reload_router
136148
from uipath.dev.server.routes.runs import router as runs_router
137149
from uipath.dev.server.ws.handler import router as ws_router
138150

151+
if auth_enabled:
152+
from uipath.dev.server.auth import restore_session
153+
from uipath.dev.server.routes.auth import router as auth_router
154+
155+
app.include_router(auth_router, prefix="/api")
156+
restore_session()
157+
139158
app.include_router(entrypoints_router, prefix="/api")
140159
app.include_router(runs_router, prefix="/api")
141160
app.include_router(graph_router, prefix="/api")

0 commit comments

Comments
 (0)