การรับรองความถูกต้องและโทเค็น Bootstrap
วัตถุประสงค์: รับโทเค็นผู้ถือและตรวจสอบพฤติกรรมจุดสิ้นสุดการรับรองความถูกต้องก่อนเรียกใช้ Inbox Manager API
หมายเหตุขอบเขต:
- โฟลว์นี้เรียกจุดสิ้นสุด
auth.inbox-manager.com - เส้นทางเหล่านั้นไม่ได้เป็นส่วนหนึ่งของ
api.inbox-manager.comOpenAPI
โฟลว์ UI
- ผู้ใช้เปิดแบบฟอร์มลงทะเบียนหรือลงชื่อเข้าใช้
- UI ส่งข้อมูลประจำตัวไปที่
https://auth.inbox-manager.com/auth/sign-upหรือ/auth/sign-in - ร้านค้า UI ส่งคืนโทเค็นการเข้าถึงและบริบทบัญชี
- UI ขอโทเค็นขอบเขตบัญชีผ่าน
POST /api/accounts/:account_id/tokenเมื่อจำเป็น - UI ใช้โทเค็นที่ส่งคืนเป็น
Authorization: Bearer <token>สำหรับapi.inbox-manager.com
โฟลว์ไลบรารีไคลเอนต์
const auth = new AuthClient({ baseUrl: "https://auth.inbox-manager.com" });
const session = await auth.signIn({
email,
password,
clientId: "cid_inbox_manager",
});
const accountToken = await auth.issueAccountToken({
accountId: session.profile.active_membership.account_id,
bearerToken: session.tokens.access_token,
audience: "https://api.inbox-manager.com",
});
const api = new InboxManagerClient({
baseUrl: "https://api.inbox-manager.com",
bearerToken: accountToken.access_token,
});
HTTP/ขดไหล
AUTH_BASE_URL="https://auth.inbox-manager.com"
ORIGIN="https://app.inbox-manager.com"
CLIENT_ID="cid_inbox_manager"
curl -sS "${AUTH_BASE_URL}/.well-known/jwks.json"
curl -sS -X POST "${AUTH_BASE_URL}/auth/sign-in" \
-H "origin: ${ORIGIN}" \
-H "content-type: application/json" \
--data "{\"client_id\":\"${CLIENT_ID}\",\"email\":\"${EMAIL}\",\"password\":\"${PASSWORD}\",\"csrf_token\":\"${CSRF_TOKEN}\"}"
curl -sS -X POST "${AUTH_BASE_URL}/api/accounts/${ACCOUNT_ID}/token" \
-H "authorization: Bearer ${ACCESS_TOKEN}" \
-H "content-type: application/json" \
--data '{"audience":"https://api.inbox-manager.com"}'
สคริปต์การตรวจสอบ
scripts/auth_probe.shscripts/auth_bootstrap_accounts.sh