> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vos.verolabs.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Tiếp tục phiên tài khoản

> Yêu cầu JWT cho phiên hiện có và hoàn tất xác thực hai lớp nếu được yêu cầu

Dùng endpoint này khi bạn đã có `sessionToken` của tài khoản. Gửi token trong `X-Auth-Session-Token`, không cần body. Giá trị này là token phiên tài khoản, không phải JWT dùng cho REST API.

```bash theme={null}
COOKIE_JAR="$(mktemp)"
chmod 600 "$COOKIE_JAR"
read -r -s -p "Token phiên: " SESSION_TOKEN
printf '\n'

AUTH_RESPONSE="$(curl --silent --show-error --fail-with-body \
  --request POST 'https://platform.verolabs.co/api/auth/mfa/resume' \
  --cookie-jar "$COOKIE_JAR" \
  --header "X-Auth-Session-Token: $SESSION_TOKEN")"
unset SESSION_TOKEN

printf '%s\n' "$AUTH_RESPONSE" | jq '{status, methods, expiresAt}'
```

Nếu `status` là `authenticated`, phản hồi chứa JWT để gọi REST API cần xác thực.

Nếu `status` là `mfa_required`, phản hồi chưa có JWT. Giữ cookie jar và hoàn tất [xác minh hai lớp](/vi/apis/rest/auth/post-api-auth-mfa-verify) bằng phương thức có trong `methods`. Dùng lại bước xác minh và lấy JWT trong [quy trình đăng nhập bằng mật khẩu](/vi/apis/rest/auth/post-api-auth-login), với `AUTH_BASE_URL="https://platform.verolabs.co"`. Xoá cookie jar khi hoàn tất xác thực.

Thiếu token trả HTTP `401` với `session_missing`. Nếu phiên không còn hợp lệ, đăng nhập lại. Yêu cầu từ trình duyệt phải cùng origin với máy chủ xác thực.


## OpenAPI

````yaml openapi.oms.vi.json POST /api/auth/mfa/resume
openapi: 3.0.3
info:
  title: VOS OMS Public API
  version: 1.0.0
  description: >-
    Public REST API surface for Vero OMS. Authentication requests use
    platform.verolabs.co. REST API requests use api-oms.verolabs.co.
servers:
  - url: https://platform.verolabs.co
    description: Authentication host
  - url: https://api-oms.verolabs.co
    description: REST API host
security: []
tags:
  - name: Authentication
    description: >-
      Đăng nhập bằng mật khẩu, xác thực hai lớp, tiếp tục phiên và khôi phục mật
      khẩu.
  - name: Trading
    description: Order entry, quote, IOI, and trading activity APIs.
  - name: Portfolio & Risk
    description: Accounts, holdings, mappings, and risk-rule read APIs.
  - name: Administration
    description: Permissions, groups, workflow, reference data, and audit APIs.
  - name: System & Diagnostics
    description: Health and latency endpoints.
paths:
  /api/auth/mfa/resume:
    post:
      tags:
        - Authentication
      summary: Tiếp tục phiên tài khoản
      description: >-
        Dùng sessionToken hiện có trong X-Auth-Session-Token để yêu cầu JWT mà
        không gửi lại mật khẩu. Trả authenticated hoặc mfa_required như bước
        đăng nhập bằng mật khẩu. Nếu cần yếu tố thứ hai, giữ cookie phản hồi và
        gọi POST /api/auth/mfa/verify. Không yêu cầu body. Yêu cầu từ trình
        duyệt phải cùng origin với máy chủ xác thực.
      operationId: post_api_auth_mfa_resume
      responses:
        '200':
          description: >-
            Phiên đã xác thực kèm JWT, hoặc yêu cầu xác thực yếu tố thứ hai đang
            chờ. Kiểm tra status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthLoginResponse'
              examples:
                authenticated:
                  summary: Xác thực hoàn tất
                  value:
                    status: authenticated
                    sessionToken: <session-token>
                    jwt: <jwt>
                    session:
                      active: true
                      authenticator_assurance_level: aal1
                      tokenized: <jwt>
                    identity: null
                    tokenizedSession:
                      active: true
                      authenticator_assurance_level: aal1
                      tokenized: <jwt>
                mfa_required:
                  summary: Cần yếu tố xác thực thứ hai; giữ Set-Cookie
                  value:
                    status: mfa_required
                    methods:
                      - totp
                      - lookup_secret
                    expiresAt: '2026-10-20T12:00:00Z'
          headers:
            Set-Cookie:
              description: >-
                Khi status là mfa_required, đặt cookie HttpOnly
                vos_mfa_challenge với Path=/api/auth, SameSite=Strict và Secure
                trên HTTPS. Giữ cookie để gọi POST /api/auth/mfa/verify. Cookie
                hết hạn tại expiresAt. Khi status là authenticated, xoá cookie
                xác thực đang chờ.
              schema:
                type: string
        '400':
          description: Yêu cầu xác thực phiên bị từ chối (invalid_mfa_request).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '401':
          description: >-
            Thiếu token phiên (session_missing), hoặc phiên không hợp lệ
            (session_invalid). Đăng nhập lại.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '403':
          description: >-
            Origin hoặc điều kiện xác thực của phiên không được chấp nhận
            (origin_not_allowed, session_invalid, session_refresh_required,
            session_aal2_required).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '409':
          description: >-
            Không có yếu tố xác thực thứ hai đã đăng ký và được hỗ trợ
            (mfa_unavailable).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '410':
          description: >-
            Cookie xác thực bị thiếu/hết hạn (challenge_expired), hoặc yêu cầu
            xác thực không còn hợp lệ (flow_expired). Đăng nhập hoặc tiếp tục
            phiên lại.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '429':
          description: Quá nhiều yêu cầu xác thực (rate_limited).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '502':
          description: >-
            Không thể xác thực hoặc không trả JWT (mfa_service_unavailable,
            missing_jwt).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
      security:
        - authSessionToken: []
      servers:
        - url: https://platform.verolabs.co
components:
  schemas:
    AuthLoginResponse:
      description: >-
        Kiểm tra status trong mọi phản hồi HTTP thành công. authenticated chứa
        JWT; mfa_required yêu cầu gọi POST /api/auth/mfa/verify với cookie từ
        phản hồi.
      oneOf:
        - $ref: '#/components/schemas/AuthAuthenticatedResponse'
        - $ref: '#/components/schemas/AuthMfaChallenge'
      discriminator:
        propertyName: status
        mapping:
          authenticated: '#/components/schemas/AuthAuthenticatedResponse'
          mfa_required: '#/components/schemas/AuthMfaChallenge'
    AuthError:
      type: object
      properties:
        error:
          type: string
          description: Machine-readable error code or error category.
        message:
          type: string
          description: Human-readable error message.
        status:
          type: integer
          format: int32
          description: Mã trạng thái HTTP của phản hồi lỗi này.
      required:
        - error
        - message
        - status
      description: >-
        Cấu trúc lỗi xác thực. Dùng mã HTTP và trường error để quyết định bước
        tiếp theo.
    AuthAuthenticatedResponse:
      type: object
      description: >-
        Xác thực hoàn tất. JWT chỉ được cấp sau khi đáp ứng tất cả yếu tố xác
        thực bắt buộc.
      properties:
        status:
          type: string
          enum:
            - authenticated
          description: Cho biết xác thực đã hoàn tất và JWT có thể được sử dụng.
        sessionToken:
          type: string
          description: >-
            Token phiên tài khoản. Giữ bí mật token này. Dùng để tiếp tục phiên;
            dùng jwt để xác thực REST API.
        jwt:
          type: string
          description: >-
            Bearer JWT cho yêu cầu REST API cần xác thực. Gửi bằng
            Authorization: Bearer <jwt>.
        session:
          description: Phiên đã xác thực và đang hoạt động.
          allOf:
            - $ref: '#/components/schemas/AuthSession'
        identity:
          description: Danh tính tài khoản, hoặc null nếu không có.
          allOf:
            - $ref: '#/components/schemas/AuthIdentity'
        tokenizedSession:
          description: Phiên đã xác thực chứa JWT trong trường tokenized.
          allOf:
            - $ref: '#/components/schemas/AuthSession'
      required:
        - status
        - sessionToken
        - jwt
        - session
        - identity
        - tokenizedSession
      additionalProperties: false
    AuthMfaChallenge:
      type: object
      description: >-
        Mật khẩu hoặc phiên hiện có đã được chấp nhận nhưng cần xác thực yếu tố
        thứ hai. Phản hồi không chứa jwt hoặc sessionToken.
      properties:
        status:
          type: string
          enum:
            - mfa_required
          description: Yêu cầu yếu tố xác thực thứ hai trước khi cấp JWT.
        methods:
          type: array
          minItems: 1
          uniqueItems: true
          description: >-
            Các phương thức đã đăng ký và đang khả dụng. totp dùng mã 6 chữ số
            trong ứng dụng xác thực; lookup_secret dùng mã dự phòng chưa sử
            dụng. Chọn phương thức từ danh sách này.
          items:
            type: string
            enum:
              - totp
              - lookup_secret
            description: Phương thức xác thực yếu tố thứ hai được hỗ trợ.
        expiresAt:
          type: string
          format: date-time
          description: >-
            Thời điểm hết hạn yêu cầu xác thực theo UTC. Đăng nhập hoặc tiếp tục
            phiên lại sau khi hết hạn.
      required:
        - status
        - methods
        - expiresAt
      additionalProperties: false
    AuthSession:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the record.
        active:
          type: boolean
          description: Indicates whether the session is active.
        authenticated_at:
          type: string
          format: date-time
          description: Timestamp when the session was authenticated.
        expires_at:
          type: string
          format: date-time
          description: Timestamp when the session expires.
        devices:
          type: array
          items:
            $ref: '#/components/schemas/AuthSessionDevice'
          description: Devices associated with the authenticated session.
        identity:
          $ref: '#/components/schemas/AuthIdentity'
        tokenized:
          type: string
          description: Bearer JWT issued for REST API calls.
        authenticator_assurance_level:
          type: string
          enum:
            - aal1
            - aal2
          description: >-
            Mức xác thực của phiên: aal1 sau khi xác thực yếu tố thứ nhất; aal2
            sau khi xác thực hai lớp thành công.
      description: >-
        Thông tin phiên đã xác thực. tokenized chứa Bearer JWT khi trường này có
        trong phản hồi.
      additionalProperties: true
    AuthIdentity:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the record.
        traits:
          type: object
          additionalProperties: true
          description: Account attributes returned with the authenticated session.
      description: >-
        Thông tin danh tính tài khoản của phiên đã xác thực, hoặc null nếu phản
        hồi không có danh tính.
      additionalProperties: true
      nullable: true
    AuthSessionDevice:
      type: object
      properties:
        ip_address:
          type: string
          description: IP address reported for the session device.
        location:
          type: string
          description: Location metadata reported for the session device.
        user_agent:
          type: string
          description: User agent reported for the session device.
      description: AuthSessionDevice schema.
  securitySchemes:
    authSessionToken:
      type: apiKey
      in: header
      name: X-Auth-Session-Token
      description: >-
        Token phiên tài khoản hiện có, được trả về trong sessionToken sau khi
        xác thực. Đây không phải Bearer JWT.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.