My App
Use caseIdentity

Get me

Use case GET /api/auth/me của Go Identity Service.

Use case: Get me

Trạng thái

Code-confirmed. Chưa checkpoint-closed trong batch Go Gateway + Go Identity.

Service sở hữu

Identity Service.

API Gateway cho phép account token hoặc branch token với route này.

Endpoint

MethodPath
GET/api/auth/me

Yêu cầu xác thực

Bearer access-like token:

  • accountAccessToken, hoặc
  • branch-scoped accessToken, hoặc
  • system access token.

Mục tiêu

Trả current account đã xác thực từ token/session.

Không trả branches[]. Go router không có GET /api/auth/me/branches.

Luồng request

Client
→ API Gateway
→ Identity Service
→ Database / token service
→ Response

Contract API

Request

{}

Success response

{
  "success": true,
  "code": "AUTH_ME_SUCCESS",
  "data": {
    "account": {
      "id": "uuid",
      "email": "user@example.test",
      "fullName": "Name",
      "status": "ACTIVE",
      "accountType": "CUSTOMER"
    }
  }
}

System account có thể có:

{
  "system": {
    "role": "SYSTEM_ADMIN",
    "scope": "SYSTEM"
  }
}

Error response

  • TOKEN_MISSING: thiếu Bearer token.
  • TOKEN_INVALID: token sai, revoked, session/account invalid.
  • TOKEN_EXPIRED.
  • ACCOUNT_LOCKED, ACCOUNT_DISABLED.

Hành vi database

Read:

  • identity.auth_session: load session bằng session_id.
  • identity.account: load account bằng account_id.

Write:

  • Không ghi DB trong happy path.

Hành vi token/session

  • Identity verify access token.
  • Session phải active, chưa revoked, chưa expired.
  • Account phải active.
  • Không issue token mới.
  • Không set cookie.

Logs và observability

  • Gateway access log có route_id=identity-auth nếu đi qua Gateway.
  • Identity log có path=/api/auth/me.
  • Không log token hoặc response body.

Tiêu chí nghiệm thu

  • Happy path pass.
  • Error path pass.
  • Logs có request/correlation id nếu đi qua Gateway.
  • Bruno/local smoke test pass nếu có.

TODO

  • Chưa đóng: checkpoint chính cho GET /api/auth/me.

On this page