Authenticating with the Payments Wallet
When the wallet is not signed in (detected via npx awal status or when wallet operations fail with authentication errors), use the npx awal CLI to authenticate.
If you have access to email, you can authenticate the wallet yourself, otherwise you'll need to ask your human to give you an email address and to tell you the OTP code they receive.
Authentication Flow
Authentication uses a two-step email OTP process:
Step 1: Initiate login
CODEBLOCK0
This sends a 6-digit verification code to the email and outputs a flowId.
Step 2: Verify OTP
CODEBLOCK1
Use the flowId from step 1 and the 6-digit code from the user's email to complete authentication. If you have the ability to access the user's email, you can read the OTP code, or you can ask your human for the code.
Checking Authentication Status
CODEBLOCK2
Displays wallet server health and authentication status including wallet address.
Example Session
CODEBLOCK3
Available CLI Commands
| Command | Purpose |
|---|
| INLINECODE4 | Check server health and auth status |
| INLINECODE5 |
Send OTP code to email, returns flowId |
|
npx awal@latest auth verify <flowId> <otp> | Complete authentication with OTP code |
|
npx awal@latest balance | Get USDC wallet balance |
|
npx awal@latest address | Get wallet address |
|
npx awal@latest show | Open the wallet companion window |
JSON Output
All commands support --json for machine-readable output:
CODEBLOCK4
技能名称: authenticate-wallet
使用支付钱包进行身份验证
当钱包未登录时(通过 npx awal status 检测到,或钱包操作因身份验证错误而失败),请使用 npx awal CLI 进行身份验证。
如果你可以访问电子邮件,你可以自行验证钱包;否则,你需要请你的用户提供一个电子邮件地址,并告知你他们收到的 OTP 验证码。
身份验证流程
身份验证采用两步电子邮件 OTP 流程:
第一步:发起登录
bash
npx awal@latest auth login
此操作会向该邮箱发送一个 6 位验证码,并输出一个 flowId。
第二步:验证 OTP
bash
npx awal@latest auth verify
使用第一步中的 flowId 和用户邮箱中的 6 位验证码完成身份验证。如果你能够访问用户的邮箱,你可以直接读取 OTP 验证码,或者你可以向你的用户索取该验证码。
检查身份验证状态
bash
npx awal@latest status
显示钱包服务器健康状态和身份验证状态,包括钱包地址。
示例会话
bash
检查当前状态
npx awal@latest status
开始登录(向邮箱发送 OTP)
npx awal@latest auth login user@example.com
输出: flowId: abc123...
用户收到验证码后,进行验证
npx awal@latest auth verify abc123 123456
确认身份验证
npx awal@latest status
可用的 CLI 命令
| 命令 | 用途 |
|---|
| npx awal@latest status | 检查服务器健康状态和身份验证状态 |
| npx awal@latest auth login <email> |
向邮箱发送 OTP 验证码,返回 flowId |
| npx awal@latest auth verify
| 使用 OTP 验证码完成身份验证 |
| npx awal@latest balance | 获取 USDC 钱包余额 |
| npx awal@latest address | 获取钱包地址 |
| npx awal@latest show | 打开钱包伴侣窗口 |
JSON 输出
所有命令均支持 --json 参数,用于输出机器可读格式:
bash
npx awal@latest status --json
npx awal@latest auth login user@example.com --json
npx awal@latest auth verify --json