◈ SecuriX

CLI & Server Quickstart

Build secure agents for terminal tools or backend services using Device Auth.

CLI & Server Quickstart

This guide is for applications without a browser interface, such as CLI tools, IoT devices, or purely server-side scripts. It uses the Device Auth Flow.

🤖

Copy LLM Prompt

Copy this prompt to your favorite LLM (ChatGPT, Claude, etc.) to get help building with SecuriX using the full documentation context.

I want to build a secure CLI tool using SecuriX. Please refer to the documentation at these URLs to help me implement it:
- Full documentation: https://securix.app/llms-full.txt
- Documentation index: https://securix.app/llms.txt

Quick Example

1. Install SDK

npm install @securix/core

2. Initiate Device Flow

src/index.ts

import { Securix } from "@securix/core";

async function main() {
  const { authUrl, deviceAuthCode } = await Securix.auth.createSession({
    entityId: "cli_user_1",
    flow: "device",
    providers: {
      gmail: { scopes: ["https://www.googleapis.com/auth/gmail.readonly"] }
    }
  });

  console.log(`🔗 Please authenticate by visiting: ${authUrl}`);
  console.log(`🔑 Enter this code when prompted: ${deviceAuthCode}`);
}

main();

3. Use official SDK

Once the user has authenticated via the URL and code, you can use the SecuriX Proxy.

import { google } from "googleapis";

const gmail = google.gmail({
  version: "v1",
  rootUrl: "https://gmail.api.securix.app",
  headers: {
    "securix-api-key": process.env.SECURIX_API_KEY,
    "securix-entity-id": "cli_user_1",
    "securix-agent-id": "gemini_vscode_1",
  },
});

const { data } = await gmail.users.messages.list({ userId: "me" });
console.log(JSON.stringify(data));

The SecuriX proxy handles token injection and security rules automatically.

Next Steps

On this page