member_center/docs/TEST_SITE.md
2026-04-23 00:30:09 +09:00

67 lines
1.8 KiB
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.

# Member Center Test Site
`src/MemberCenter.TestSite` 是手動 happy-path 測試用網站,用來先驗證外部網站整合會員中心的最小流程。
## 啟動
```bash
dotnet run --project src/MemberCenter.TestSite
```
預設 HTTP URL
```text
http://localhost:5243
```
## 必要設定
`src/MemberCenter.TestSite/appsettings.Development.json` 或環境變數設定:
```json
{
"MemberCenter": {
"ApiBaseUrl": "http://localhost:7850",
"WebLoginClientId": "<web_login client id>",
"ServiceClientId": "<service client id>",
"ServiceClientSecret": "<service client secret>"
}
}
```
`web_login` OAuth client
- `usage=web_login`
- `client_type=public`
- redirect URI: `http://localhost:5243/auth/callback`
- scopes: `openid email profile profile:basic.read profile:basic.write profile:addresses.read profile:addresses.write profile:subscriptions.read profile:subscriptions.write`
service OAuth client
- 建議使用 `tenant_api``platform_service`
- `client_type=confidential`
- scopes 至少包含 `profile:basic.read profile:addresses.read`
若 Member Center API 與 Web login 不同 originMember Center 需設定:
```text
Auth__WebLoginUrl=<Member Center Web login URL>
Auth__AllowedLoginReturnUrlPrefixes=<Member Center API issuer/base URL>
Auth__CookieDomain=<shared cookie domain, production subdomain SSO only>
```
## 第一批 Happy Path
測試站目前包含:
1. Redirect login 拿 token
2. API login 拿 token
3. `GET /user/profile`
4. `POST /user/profile`
5. `GET /user/addresses`
6. `POST /user/addresses`
7. `GET /user/subscriptions`
8. `POST /user/subscriptions/{id}/unsubscribe`
9. service token 呼叫 `GET /user/profile/by-email`
10. service token 呼叫 `GET /user/addresses/by-email`
測試站只做 happy path不取代完整自動化測試。