gitlink-cli/skills/gitlink-auth/examples/auth-workflow.md

49 lines
883 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 认证工作流示例
**场景**:首次使用 gitlink-cli 的用户需要完成登录认证。
## 工作流步骤
### Step 1交互式登录
```bash
# 方式 1用户名密码登录
gitlink-cli auth login
# 按提示输入用户名和密码
# 方式 2使用已有 Token
gitlink-cli auth login --token
# 粘贴 GitLink 个人访问令牌
```
### Step 2验证登录状态
```bash
gitlink-cli auth status
```
**输出示例:**
```
已登录为: zhangsan
Token 有效期至: 2026-06-19
存储位置: OS Keychain
```
### Step 3Token 过期后重新登录
```bash
# 遇到 401 错误时,重新登录
gitlink-cli auth login
# 退出登录
gitlink-cli auth logout
```
---
## 注意事项
- GitLink Token 有效期 7 天,过期需重新登录
- Token 存储在系统密钥管理器中,安全可靠
- 非交互环境可设置环境变量 `GITLINK_TOKEN`