SecureDesk is a production-minded corporate AI agent built for the Auth0 hackathon Authorized to Act: Auth0 for AI Agents.
The project shows how an AI agent can act on behalf of a real user across Slack and Gmail while keeping provider credentials inside Auth0 Token Vault, enforcing explicit authorization boundaries, requiring approval for sensitive actions, and writing every meaningful step to a persistent audit trail.
SecureDesk gives the user a natural-language workspace where they can ask the agent to operate across connected business tools. The language layer makes the interaction feel conversational, but the execution layer stays deterministic and policy-driven.
Current live actions:
- List Slack channels
- Post a Slack message
- List unread Gmail messages
- Summarize today's Gmail messages
- Send a Gmail message
The product is built around a visible trust model:
- the user explicitly connects Slack and Gmail through Auth0 Connected Accounts
- SecureDesk checks Auth0 FGA before running any provider action
- high-risk actions pause for approval through CIBA / Guardian when available, with a secure in-app review fallback
- provider access is exchanged server-side through Token Vault
- every action is written to a persistent audit log and surfaced in the Trust Center
- Auth0 Next.js SDK for login, sessions, and protected routes
- Auth0 Connected Accounts for Slack and Gmail user connections
- Auth0 Token Vault for delegated provider token exchange
- Auth0 FGA for per-tool authorization
- Auth0 CIBA and Guardian for external approval of high-risk actions
- Secure in-product approval runtime when CIBA is unavailable
- Next.js 14 App Router
- React 18
- TypeScript
- Tailwind CSS
- Framer Motion
- Zustand for client state used by the Trust Center and audit views
- Lucide React icons
SecureDesk currently runs on a stable Next.js App Router foundation that was kept intentionally steady during hackathon implementation so the security flows, provider integrations, and approval runtime could be hardened without introducing last-minute framework migration risk.
- Gemini
gemini-2.5-flash - Gemini integration for natural-language intent parsing and response refinement
- Graceful fallback to deterministic responses when Gemini is unavailable
- Natural-language intent parsing plus response polishing, while execution remains deterministic
- Neon Postgres linked through Vercel Storage
@vercel/postgresraw SQL for persistent audit logs and approval sessions- Prisma Client for connected-service snapshots used by the settings experience
- Vercel-ready environment variable flow for cloud deployment
- The user signs in with Auth0.
- The user connects Slack and Gmail in Settings through Auth0 Connected Accounts.
- The user asks SecureDesk to perform an action in natural language.
- Gemini interprets or refines the request when available.
- SecureDesk resolves the request into a known action inside the runtime.
- Auth0 FGA decides whether the current user may invoke that tool.
- SecureDesk classifies the action as low-risk or high-risk.
- High-risk actions pause for approval through CIBA / Guardian or the in-product review flow.
- SecureDesk exchanges delegated provider access through Auth0 Token Vault.
- Slack or Gmail is called server-side.
- The result is stored in Postgres and surfaced in the Audit Log and Trust Center.
SecureDesk is designed to score well against the hackathon's security and user-control criteria.
Slack and Gmail tokens are never exposed to the frontend. SecureDesk requests delegated access only when it is ready to execute a permitted action.
Each supported tool action is protected by Auth0 FGA. The runtime fails closed if policy is unavailable.
Write actions such as posting to Slack or sending email require explicit review before release. Approval state is validated server-side and persisted in the database.
Audit entries and approval sessions are stored in Postgres, so they survive refreshes, cold starts, and redeploys. The Trust Center and Audit Log read from the database in real time.
The repository contains a complete working product slice:
- marketing landing page
- Auth0 sign-in flow
- workspace chat UI
- Slack and Gmail connection flow in Settings
- live Trust Center sidebar
- Audit Log page with filters and CSV export
- approval modal and CIBA polling flow
- persistent audit log and approval-session storage
List my Slack channelsPost a message to #general-securedesk saying: Hello from SecureDeskList my unread emailsSummarize my emails from todaySend an email to teammate@example.com saying: Hello from SecureDeskWhat can you do for me today?
- Install dependencies:
npm install-
Copy
.env.exampleto.env.localand fill the values. -
Generate Prisma Client:
npm run postinstall- Start the development server:
npm run dev- Once Postgres is configured, call the migration route one time:
GET /api/migrateThat route creates the persistent audit_logs and approval_sessions tables.
AUTH0_SECRETAUTH0_BASE_URLAUTH0_ISSUER_BASE_URLAUTH0_CLIENT_IDAUTH0_CLIENT_SECRETAUTH0_AUDIENCE
AUTH0_TOKEN_VAULT_CLIENT_IDAUTH0_TOKEN_VAULT_CLIENT_SECRET
AUTH0_TOKEN_VAULT_ENABLEDSLACK_CONNECTION_NAMESLACK_CONNECTION_IDGMAIL_CONNECTION_NAMEGMAIL_CONNECTION_ID
AUTH0_CIBA_CLIENT_IDAUTH0_CIBA_CLIENT_SECRETAUTH0_CIBA_AUDIENCE
FGA_API_URLFGA_STORE_IDFGA_MODEL_IDFGA_CLIENT_IDFGA_CLIENT_SECRETFGA_API_TOKEN_ISSUERFGA_API_AUDIENCE
GEMINI_API_KEY_1GEMINI_API_KEY_2GEMINI_API_KEY_3GEMINI_API_KEY_4GEMINI_MODEL
POSTGRES_URLPOSTGRES_PRISMA_URLPOSTGRES_URL_NON_POOLINGPOSTGRES_USERPOSTGRES_HOSTPOSTGRES_PASSWORDPOSTGRES_DATABASE
Important notes:
AUTH0_ISSUER_BASE_URLmust be the tenant root such ashttps://YOUR_TENANT.us.auth0.com- do not append
/api/v2 - when Neon is linked to the Vercel project through Storage, Vercel injects the Postgres variables automatically
- after linking the database for the first time, call
GET /api/migrateonce
SecureDesk is designed to deploy on Vercel.
Recommended production setup:
- Link the project to Neon through
Vercel Storage. - Confirm Vercel injected the Postgres variables.
- Add the Auth0, FGA, CIBA, Slack, Gmail, and Gemini variables in Project Settings.
- Deploy the app.
- Open
/api/migrateonce in the deployed environment.
No ORM migrations are required for the audit and approval core tables because they are created by the migration route.
For the hackathon build, SecureDesk stays on a stable Next.js App Router baseline so the live Auth0, Slack, Gmail, approval, and audit flows remain predictable during judging.
The post-hackathon hardening path is straightforward:
- upgrade the framework stack to the latest supported Next.js LTS line
- align the Auth0 SDK and React versions with that upgrade path
- rerun the same Slack, Gmail, FGA, approval, and audit validation suite after the migration
This keeps the judging build stable today while preserving a clear maintenance path for long-term production rollout.
Use /dashboard/settings as the live operational checklist inside the product.
High-level order:
- Create a Regular Web Application in Auth0.
- Create the custom backend API used as
AUTH0_AUDIENCE. - Enable Authorization Code, Refresh Token, and Token Vault.
- Enable Multi-Resource Refresh Token and authorize the My Account API.
- Configure Slack and Google social connections for Connected Accounts.
- Create the dedicated Token Vault exchange client.
- Configure Auth0 FGA and add tuples for the signed-in user.
- Configure CIBA and Guardian if your tenant supports them.
Detailed instructions live in docs/auth0-setup.md.
model
schema 1.1
type user
type tool
relations
define invoke: [user]
Example tuples:
user:auth0|abc123 invoke tool:read_slackuser:auth0|abc123 invoke tool:post_slack_messageuser:auth0|abc123 invoke tool:read_emailsuser:auth0|abc123 invoke tool:send_email
SecureDesk also surfaces the exact tuple values for the signed-in user in /dashboard/settings.
Before recording the demo or shipping to judges, run:
npm run lint
npm run buildThen verify:
- Slack connects successfully
- Gmail connects successfully
- low-risk reads work
- high-risk writes pause for approval
- approvals resume execution correctly
- the Audit Log shows persistent entries after refresh
- the Trust Center updates from database-backed audit data
- Auth0 Token Vault is part of the live runtime, not just the story
- Slack and Gmail are both real connected integrations
- FGA gates tool execution before provider calls
- CIBA / Guardian can approve high-risk actions when available
- SecureDesk falls back to an in-product review flow when CIBA is unavailable
- audit events and approval sessions persist in Postgres
- Gemini improves the conversational experience without taking over execution control
The repository includes a ready-to-publish blog post for the hackathon bonus submission in BLOG.md.