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

# Configurar o autenticador

> Devolve a chave do segundo fator de quem ainda não confirmou um, depois da senha.



## OpenAPI

````yaml openapi/pt/control.json POST /v1/auth/second-factor
openapi: 3.1.0
info:
  title: API de controle da Niadra
  version: '1'
  description: >-
    Tenants, projetos, fontes, chaves, pessoas, configuração e uso. Nunca recebe
    conteúdo de cliente.
servers:
  - url: https://control.api.niadra.com
security: []
paths:
  /v1/auth/second-factor:
    post:
      summary: Configurar o autenticador
      description: >-
        A configuração do autenticador, para quem recebeu 401 "second factor
        enrollment required" no login: a senha de novo, e a chave volta. O
        primeiro código certo no login confirma a chave; depois disso, esta rota
        responde 409.


        **Autenticação.** Sem autenticação.
      operationId: second_factor_v1_auth_second_factor_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SecondFactorRequest'
            example:
              email: ana@acme.example
              password: correct horse battery staple
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecondFactorOut'
              example:
                secret: JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP
                totp_uri: >-
                  otpauth://totp/Niadra:ana@acme.example?secret=JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP&issuer=Niadra&algorithm=SHA1&digits=6&period=30
          description: Resposta de sucesso.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: O pedido não bate com o contrato.
      security: []
components:
  schemas:
    SecondFactorRequest:
      additionalProperties: false
      properties:
        email:
          maxLength: 320
          minLength: 3
          title: Email
          type: string
        password:
          maxLength: 1024
          minLength: 1
          title: Password
          type: string
      required:
        - email
        - password
      title: SecondFactorRequest
      type: object
    SecondFactorOut:
      additionalProperties: false
      properties:
        secret:
          description: A chave TOTP em base32, para digitar no aplicativo autenticador.
          title: Secret
          type: string
        totp_uri:
          description: O endereço otpauth:// da mesma chave, para um QR code.
          title: Totp Uri
          type: string
      required:
        - secret
        - totp_uri
      title: SecondFactorOut
      type: object
    Problem:
      additionalProperties: false
      description: >-
        Detalhes do problema no formato da RFC 9457; `code` vem do catálogo de
        erros versionado.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object

````