auth-helper
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAuthentication Helper
身份验证助手
Help users configure authentication for the Alph.ai trading platform.
dex_cookie帮助用户为Alph.ai交易平台配置身份验证。
dex_cookieOverview
概述
Alph.ai uses browser cookie authentication. The key cookie is , which users obtain from the website after logging in.
dex_cookieWhat this skill does:
- Guide users to get their
dex_cookie - Help store and manage the cookie securely
- Verify the cookie works
- Troubleshoot authentication issues
Alph.ai采用浏览器Cookie身份验证方式。核心Cookie为,用户登录网站后即可获取。
dex_cookie本技能可实现:
- 引导用户获取
dex_cookie - 帮助安全存储和管理该Cookie
- 验证Cookie是否可用
- 排查身份验证相关问题
How Authentication Works
身份验证流程
text
1. User logs in at https://www.alph.ai
2. Browser receives dex_cookie from server
3. User copies dex_cookie value
4. Agent uses it in API calls as: Cookie: dex_cookie=<value>Each user has their own unique . It is tied to their account session.
dex_cookietext
1. 用户在https://www.alph.ai登录
2. 浏览器从服务器接收dex_cookie
3. 用户复制dex_cookie的值
4. Agent在API调用中使用该Cookie,格式为:Cookie: dex_cookie=<值>每个用户都有唯一的,该Cookie与用户的账户会话绑定。
dex_cookieSetup Workflow
设置流程
Step 1: Get Your dex_cookie
步骤1:获取你的dex_cookie
Guide the user through these steps:
text
1. Open https://www.alph.ai in your browser
2. Log in to your account
3. Press F12 to open Developer Tools
4. Go to Application tab → Cookies → www.alph.ai
5. Find "dex_cookie" in the list
6. Copy the Value (it looks like: NWMx...NA==)Alternative method (Network tab):
text
1. After login, press F12 → Network tab
2. Click any page that loads data
3. Click any API request (to b.alph.ai)
4. In Request Headers, find "Cookie:"
5. Copy the dex_cookie=... value引导用户完成以下步骤:
text
1. 在浏览器中打开https://www.alph.ai
2. 登录你的账户
3. 按下F12打开开发者工具
4. 进入「Application」标签页 → 「Cookies」 → www.alph.ai
5. 在列表中找到"dex_cookie"
6. 复制其「Value」值(格式类似:NWMx...NA==)替代方法(网络标签页):
text
1. 登录后,按下F12 → 「Network」标签页
2. 点击任意加载数据的页面
3. 点击任意API请求(目标为b.alph.ai)
4. 在「Request Headers」中找到"Cookie:"
5. 复制dex_cookie=...部分的值Step 2: Store the Cookie
步骤2:存储Cookie
Option A: Environment Variable (Recommended)
bash
undefined选项A:环境变量(推荐)
bash
undefinedAdd to your shell profile (~/.zshrc or ~/.bashrc)
添加到你的shell配置文件(/.zshrc或/.bashrc)
export ALPH_DEX_COOKIE="NWMxMmEwN2Qt...NA=="
export ALPH_DEX_COOKIE="NWMxMmEwN2Qt...NA=="
Reload
重新加载配置
source ~/.zshrc
**Option B: Secure File**
```bashsource ~/.zshrc
**选项B:安全文件**
```bashStore in a file with restricted permissions
将Cookie存储到权限受限的文件中
echo "NWMxMmEwN2Qt...NA==" > ~/.alph_cookie
chmod 600 ~/.alph_cookie
echo "NWMxMmEwN2Qt...NA==" > ~/.alph_cookie
chmod 600 ~/.alph_cookie
Read when needed
需要时读取该值
export ALPH_DEX_COOKIE=$(cat ~/.alph_cookie)
**Option C: macOS Keychain**
```bashexport ALPH_DEX_COOKIE=$(cat ~/.alph_cookie)
**选项C:macOS钥匙串**
```bashStore
存储Cookie
security add-generic-password -a "alph-ai" -s "dex-cookie" -w "NWMxMmEwN2Qt...NA=="
security add-generic-password -a "alph-ai" -s "dex-cookie" -w "NWMxMmEwN2Qt...NA=="
Retrieve
检索Cookie
export ALPH_DEX_COOKIE=$(security find-generic-password -a "alph-ai" -s "dex-cookie" -w)
undefinedexport ALPH_DEX_COOKIE=$(security find-generic-password -a "alph-ai" -s "dex-cookie" -w)
undefinedStep 3: Verify Authentication
步骤3:验证身份验证
bash
undefinedbash
undefinedTest with a simple authenticated endpoint
通过简单的需身份验证端点测试
curl -s -X POST "https://b.alph.ai/smart-web-gateway/order/statistic"
-H "Content-Type: application/json"
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}"
-d '{"chain":"sol"}'
-H "Content-Type: application/json"
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}"
-d '{"chain":"sol"}'
**Success response:**
```json
{
"code": "200",
"data": {
"code": 200,
"orderCount": 638,
"success": true
}
}Failed response (expired or invalid cookie):
json
{
"code": "403",
"msg": "token error"
}curl -s -X POST "https://b.alph.ai/smart-web-gateway/order/statistic"
-H "Content-Type: application/json"
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}"
-d '{"chain":"sol"}'
-H "Content-Type: application/json"
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}"
-d '{"chain":"sol"}'
**成功响应:**
```json
{
"code": "200",
"data": {
"code": 200,
"orderCount": 638,
"success": true
}
}失败响应(Cookie过期或无效):
json
{
"code": "403",
"msg": "token error"
}Step 4: Use in API Calls
步骤4:在API调用中使用
All authenticated requests use the same pattern:
bash
curl -s "https://b.alph.ai/smart-web-gateway/..." \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}"For POST requests, also add:
bash
-H "Content-Type: application/json" \
-d '{"chain":"sol", ...}'所有需身份验证的请求均采用以下格式:
bash
curl -s "https://b.alph.ai/smart-web-gateway/..." \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}"对于POST请求,还需添加:
bash
-H "Content-Type: application/json" \
-d '{"chain":"sol", ...}'Cookie Details
Cookie详情
Format
格式
- Encoding: Base64
- Decoded content: (e.g.,
UUID + timestamp+5c12a07d-6db2-404d-88e3-2832a084d381)1771918855874 - Always ends with (base64 padding)
==
- 编码方式:Base64
- 解码后内容:(示例:
UUID + 时间戳+5c12a07d-6db2-404d-88e3-2832a084d381)1771918855874 - 始终以 结尾(Base64填充字符)
==
Expiry
有效期
The expires after a period of inactivity. When expired:
dex_cookie- API returns
{"code":"403","msg":"token error"} - User needs to re-login at https://www.alph.ai
- Copy the new value
dex_cookie - Update the stored value
dex_cookie- API会返回
{"code":"403","msg":"token error"} - 用户需重新登录https://www.alph.ai
- 复制新的值
dex_cookie - 更新已存储的Cookie值
Security
安全注意事项
- Never commit your to git or share publicly
dex_cookie - Never log the cookie value in terminal output
- Use for cookie files
chmod 600 - Each cookie is personal - never share between users
- Add to
.alph_cookie.gitignore
- 绝对不要将提交到git仓库或公开分享
dex_cookie - 绝对不要在终端输出中记录Cookie值
- 对存储Cookie的文件使用权限
chmod 600 - 每个Cookie均为个人专属,不要在用户间共享
- 将添加到
.alph_cookie中.gitignore
What Needs Authentication
需要身份验证的功能
| Feature | Auth Required? |
|---|---|
| Token prices, ticker data | No |
| Holder stats, whale tracking | No |
| Smart wallet list & analytics | No |
| Hot token discovery | No |
| Place orders (buy/sell) | Yes |
| Limit/pending orders | Yes |
| Copy trading (follow wallets) | Yes |
| Order history & statistics | Yes |
| Buy/sell settings | Yes |
| Wallet management | Yes |
| 功能 | 是否需要身份验证? |
|---|---|
| 代币价格、行情数据 | 否 |
| 持有者统计、巨鲸追踪 | 否 |
| 智能钱包列表及分析 | 否 |
| 热门代币发现 | 否 |
| 下单(买入/卖出) | 是 |
| 限价/挂单 | 是 |
| 跟单交易(追踪钱包) | 是 |
| 订单历史与统计 | 是 |
| 买卖设置 | 是 |
| 钱包管理 | 是 |
Troubleshooting
问题排查
"token error" (403)
「token error」(403错误)
Cause: Cookie expired or invalid.
Fix:
- Re-login at https://www.alph.ai
- Get fresh from browser DevTools
dex_cookie - Update your stored value
Cookie doesn't work
Cookie无法使用
Check:
- Make sure the value ends with (base64 padding)
== - Don't include prefix in the value - just the Base64 string
dex_cookie= - Make sure you're using as the header format
Cookie: dex_cookie=...
检查项:
- 确认Cookie值以结尾(Base64填充字符)
== - 不要包含前缀,仅需Base64字符串
dex_cookie= - 确保请求头格式为
Cookie: dex_cookie=...
"sys error" (500)
「sys error」(500错误)
Cause: Server issue or missing required params.
Fix:
- Add to POST request body
"chain":"sol" - Check if the endpoint is currently available (some are under maintenance)
- Retry after a moment
原因:服务器问题或缺少必填参数。
解决方法:
- 在POST请求体中添加
"chain":"sol" - 检查该端点是否可用(部分端点可能处于维护中)
- 稍后重试
Example Agent Interaction
Agent交互示例
text
User: "I want to check my orders"
Agent:
1. Check if ALPH_DEX_COOKIE env var exists
2. If not:
"To use trading features, you need to set up authentication first.
Please:
1. Log in at https://www.alph.ai
2. Press F12 → Application → Cookies → www.alph.ai
3. Copy the 'dex_cookie' value
4. Tell me the value (or set it as env var: export ALPH_DEX_COOKIE=...)"
3. If yes: proceed to call order API with the cookie
4. If API returns 403: "Your session has expired. Please re-login and get a new cookie."text
用户:"我想查看我的订单"
Agent:
1. 检查环境变量ALPH_DEX_COOKIE是否存在
2. 如果不存在:
"要使用交易功能,你需要先完成身份验证设置。
请按照以下步骤操作:
1. 登录https://www.alph.ai
2. 按下F12 → 「Application」 → 「Cookies」 → www.alph.ai
3. 复制'dex_cookie'的值
4. 将该值告知我(或设置为环境变量:export ALPH_DEX_COOKIE=...)"
3. 如果存在:使用该Cookie调用订单API
4. 如果API返回403错误:"你的会话已过期,请重新登录并获取新的Cookie。"Related Skills
相关技能
- market-data: Public endpoints work without authentication
- trading-execution: All trading operations need
dex_cookie
- market-data:公开端点无需身份验证即可使用
- trading-execution:所有交易操作均需
dex_cookie