post:
  tags:
    - Login
  summary: >-
    Verify 2FA token of the user. Requires enabled 2FA or time based one time
    code generation (totp_enabled=true).
  operationId: Verify2faPost
  description: >-
    Returns authorization JWT token if athe provided username and his 2fa token
    are valid. If totp_enabled is true, you should provide one time password as
    2fa token.
     If both 2FA and TotP are disabled, this api will return 400.
  parameters:
    - name: token-lifetime
      in: query
      description: >-
        initial lifetime of JWT token in seconds. Max value is 90 days. Default:
        10 min
      schema:
        maximum: 7776000
        type: integer
        default: 600
  requestBody:
    description: Username and his 2FA token
    content:
      '*/*':
        schema:
          type: object
          properties:
            username:
              type: string
              description: Unique username
            token:
              type: string
              description: >-
                2FA or TotP options should be enabled. Requires JWT bearer token
                received from `/login` endpoint. 2FA token that was sent to the
                user by `/login` endpoints or generated by an Authenticator
                application. If totp_enabled is true, provide here one time
                password generated by an Authenticator app.
    required: true
  responses:
    '200':
      description: Successful Operation
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: object
                properties:
                  token:
                    type: string
                    description: Authorization JWT token
    '400':
      description: Invalid Request
      content:
        application/json:
          schema:
            $ref: ../components/schemas/ErrorPayload.yaml
    '401':
      description: Unauthorized, if invalid login token is provided
      content:
        application/json:
          schema:
            $ref: ../components/schemas/ErrorPayload.yaml
    '409':
      description: >-
        2FA is disabled. If totp_enabled is true, this error will indicate that
        the user hasn't generated a TotP private key yet (see /me/totp-secret)
      content:
        application/json:
          schema:
            $ref: ../components/schemas/ErrorPayload.yaml
    '500':
      description: Invalid Operation
      content:
        application/json:
          schema:
            $ref: ../components/schemas/ErrorPayload.yaml
  x-codegen-request-body-name: body
