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

# Validate the Second Factor During Login

> Verify the submitted TOTP for a pending `mfa` interaction, completing a pending enrolment when there is one, and finish the interaction with `otp` appended to the session `amr`. The authorization code is only ever issued after this succeeds. The front-end must then navigate to GET /oidc/auth/{grant} to resume the authorization request.



## OpenAPI

````yaml /api-reference/swagger.yml post /oidc/interaction/{grant}/mfa
openapi: 3.0.0
info:
  version: 1.0.0
  title: Prisme.ai APIs
  description: Prisme.ai APIs specifications
  termsOfService: https://www.prisme.ai/mentions-legales
  contact:
    name: Prisme.ai Support Team
    email: support@prisme.ai
    url: https://www.prisme.ai
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.studio.prisme.ai
    description: Prisme.ai Cloud
  - url: https://{customDomain}
    description: Self-hosted Prisme.ai instance
    variables:
      customDomain:
        default: api.your-prisme-instance.com
        description: API hostname of your self-hosted Prisme.ai deployment
  - url: http://localhost:3001
    description: Local development
security:
  - BearerAuth: []
  - OrgApiKeyAuth: []
  - BearerAuth: []
    OrgApiKeyAuth: []
tags:
  - name: API Gateway
    description: >-
      Authentication, session management, SSO providers, and user profile
      endpoints.
  - name: Prisme.ai Workspaces
    description: >-
      CRUD operations for workspaces and their resources (pages, apps,
      automations, imports, variables).
  - name: Prisme.ai Runtime
    description: Execute workspace automations and manage their runtime lifecycle.
  - name: Prisme.ai Events
    description: Event ingestion, delivery, and subscription filtering across the platform.
  - name: Organizations
    description: >-
      Manage organizations, members, roles, invites, groups, and org-level
      service accounts.
  - name: Subscriptions
    description: >-
      Manage organization subscription plans and tier assignments (SuperAdmin
      only).
  - name: Secrets
    description: Read and patch encrypted key-value secrets scoped to a workspace.
  - name: ApiKeys
    description: Create, list, rotate, and validate workspace-scoped API keys.
  - name: Permissions
    description: >-
      Share or unshare resources (workspaces, pages, …) with users via roles or
      fine-grained rules.
  - name: Monitoring
    description: Platform readiness checks across services (SuperAdmin only).
  - name: AuthProviders
  - name: OIDC
    description: >-
      Endpoints of the embedded OpenID Connect provider, mounted under /oidc.
      The protocol endpoints follow OpenID Connect Core / OAuth 2.0 and are best
      resolved from GET /oidc/.well-known/openid-configuration; the
      /oidc/interaction/* routes are Prisme.ai-specific and covered by no
      standard.
paths:
  /oidc/interaction/{grant}/mfa:
    post:
      tags:
        - OIDC
      summary: Validate the Second Factor During Login
      description: >-
        Verify the submitted TOTP for a pending `mfa` interaction, completing a
        pending enrolment when there is one, and finish the interaction with
        `otp` appended to the session `amr`. The authorization code is only ever
        issued after this succeeds. The front-end must then navigate to GET
        /oidc/auth/{grant} to resume the authorization request.
      operationId: validateOidcInteractionMFA
      parameters:
        - name: grant
          in: path
          description: Interaction uid
          required: true
          schema:
            type: string
      requestBody:
        required: true
        description: >-
          The route accepts both encodings; the Prisme.ai SDK submits the
          form-encoded one.
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - totp
              properties:
                totp:
                  type: string
                  description: Six-digit code produced by the authenticator
          application/json:
            schema:
              type: object
              required:
                - totp
              properties:
                totp:
                  type: string
                  description: Six-digit code produced by the authenticator
      responses:
        '303':
          description: Redirect back to the authorization request
        '400':
          description: No MFA interaction in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadParametersError'
        '401':
          description: AuthenticationError
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationError'
        '429':
          description: Too many requests
      security: []
components:
  schemas:
    BadParametersError:
      type: object
      properties:
        error:
          type: string
          example: BadParameters
        message:
          type: string
        details: {}
    AuthenticationError:
      type: object
      properties:
        error:
          type: string
          example: AuthenticationError
        message:
          type: string
          example: Unauthenticated
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    OrgApiKeyAuth:
      type: apiKey
      in: header
      name: x-prismeai-api-key

````