Files
2026-03-26 20:22:34 +08:00

29 lines
730 B
Markdown
Raw Permalink 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.

---
name: "ulthon-auth-session-token"
description: "解释并指导 Session+Token 登录认证的使用方式。需要实现接口鉴权或联调移动端请求时调用。"
---
# 登录认证Session + Token
## 何时调用
- 编写/联调需要登录态的接口。
- 需要在非浏览器环境(移动端、小程序、跨域脚本)调用后台接口。
## 机制概览
- Session主要用于浏览器环境依赖 Cookie。
- Token用于接口与无 Cookie 场景,通过 Header 传递完成认证。
## 使用方式
1. 登录成功后,接口会返回 `token` 数据。
2. 后续请求在 Header 携带:
```text
Authorization: Bearer <token>
```
3. 系统会自动识别并完成身份认证。