← 返回
未分类 Key 中文

Agnic Authenticate Wallet (x402)

Authenticate Agnic wallet via browser OAuth or headless API token. Use when the user wants to sign in, log in, authenticate, connect wallet, set up CLI, or r...
通过浏览器OAuth或无头API令牌认证Agnic钱包。用于登录、身份验证、连接钱包、CLI配置等场景。
agnicpay-prog agnicpay-prog 来源
未分类 clawhub v2.0.2 1 版本 100000 Key: 需要
★ 0
Stars
📥 575
下载
💾 0
安装
1
版本
#latest

概述

Authenticating the Agnic Wallet

Check Current Status

npx agnic@latest status --json

If already authenticated, no further action needed. If not, choose the appropriate mode below.

Mode 1: Headless / Token Auth (CI, servers, agents)

Preferred when no browser is available. Generate an API token at app.agnic.ai > Settings > API Tokens.

Option A -- Environment variable (recommended for automation):

export AGNIC_TOKEN=<your-api-token>
npx agnic@latest status --json

The CLI reads AGNIC_TOKEN automatically. All subsequent commands in the same shell session use it without extra flags.

Option B -- Inline flag (one-off commands):

npx agnic@latest --token <your-api-token> status --json

Mode 2: Browser OAuth (interactive terminals)

Use when a browser is available:

npx agnic@latest auth login

This command:

  1. Starts a temporary local server on a random port
  2. Opens the default browser to the Agnic OAuth consent screen
  3. The user signs in (email, Google, or wallet) and approves spending limits
  4. The browser redirects back to http://localhost:/callback
  5. The CLI exchanges the authorization code for tokens and saves them locally

Wait for the CLI to print Authenticated! before proceeding.

Verify Authentication

npx agnic@latest status --json

Expected output:

{
  "authenticated": true,
  "userId": "did:privy:...",
  "email": "user@example.com",
  "walletAddress": "0x...",
  "tokenExpiry": "2026-05-22T14:30:00Z"
}

Logout

To remove stored credentials:

npx agnic@latest auth logout

Token Storage

  • Browser mode: credentials stored in ~/.agnic/config.json with 0600 permissions. Tokens auto-refresh on 401 responses. Refresh token expires after 90 days.
  • Token mode: no local storage. The token is read from AGNIC_TOKEN env var or --token flag per invocation.

Error Handling

  • "Not authenticated" -- Set AGNIC_TOKEN env var, pass --token, or run auth login
  • "Authentication failed" -- User cancelled the browser flow or the 5-min timeout expired
  • "Could not open browser" -- The CLI prints a URL to copy and open manually
  • "Token expired" -- Browser tokens auto-refresh; API tokens must be regenerated at app.agnic.ai
  • "Invalid token" -- Check the token value; it may have been revoked or malformed

版本历史

共 1 个版本

  • v2.0.2 当前
    2026-05-03 05:09 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

1password

steipete
设置和使用 1Password CLI (op)。适用于:安装 CLI、启用桌面应用集成、登录(单/多账户)、通过 op 读取/注入/运行密钥。
★ 53 📥 31,457
it-ops-security

MoltGuard - Security & Antivirus & Guardrails

thomaslwang
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装 MoltGuard,保护您和您的用户免受提示注入、数据泄露和恶意攻击。
★ 116 📥 30,834
it-ops-security

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 90 📥 30,771