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

# OAuth2 Authorize MFA

> Verifies MFA code during OAuth2 authorization flow. This endpoint is called after oauth2_Authorize when MFA is required. The user provides the verification code that was sent to their registered phone number along with the next_step_auth_id received from the previous authorization step.



## OpenAPI

````yaml https://spec.speakeasy.com/aries/aries/aries-trading-platform-api-with-code-samples post /v1/oauth2/authorize/mfa
openapi: 3.0.3
info:
  title: Aries Trading Platform API
  description: >-
    Complete API documentation for the Aries trading platform including user
    management, authentication, account management, order management, market
    data, and analytics
  contact:
    name: Aries Financial
    email: dev@aries.com
  version: 1.0.0
servers:
  - url: https://api.tradearies.dev
    description: Production server
security: []
tags:
  - name: Accounts
    description: Account management endpoints for positions, orders, and balances
  - name: Analytics
    description: >-
      Analytics endpoints for market data analysis including top gainers,
      losers, volume leaders, sector analysis, analyst ratings, market breadth,
      and net inflow
  - name: Authentication
    description: User authentication endpoints
  - name: Calendars
    description: Calendar endpoints for economic events and historical data
  - name: Market Data
    description: >-
      Market data endpoints for symbol search, real-time data access, and equity
      details
  - name: Orders
    description: >-
      Order management endpoints for placing, updating, canceling, and
      previewing orders
  - name: Users
    description: User management endpoints
  - name: Health
    description: Service health endpoints
paths:
  /v1/oauth2/authorize/mfa:
    post:
      tags:
        - OAuth2
      summary: OAuth2 Authorize MFA
      description: >-
        Verifies MFA code during OAuth2 authorization flow. This endpoint is
        called after oauth2_Authorize when MFA is required. The user provides
        the verification code that was sent to their registered phone number
        along with the next_step_auth_id received from the previous
        authorization step.
      operationId: oauth2_Token_Authorize_MFA
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                next_step_auth_id:
                  type: string
                  description: Authorization session ID from /v1/oauth2/authorize
                  example: auth_mfa_123abc
                verification_code:
                  type: string
                  pattern: ^[0-9]{6}$
                  description: 6-digit verification code sent to user's phone
                  example: '123456'
              required:
                - next_step_auth_id
                - verification_code
            example:
              next_step_auth_id: auth_mfa_123abc
              verification_code: '123456'
        required: true
      responses:
        '200':
          description: MFA verification successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  next_step_auth_id:
                    type: string
                    description: Updated authorization session ID for next step
                  consent_required:
                    type: boolean
                    description: Whether user consent is required
                  client_name:
                    type: string
                    description: Name of the OAuth2 client
                  scopes:
                    type: array
                    items:
                      type: string
                    description: List of requested scopes
              example:
                next_step_auth_id: auth_confirm_456def
                consent_required: true
                client_name: My Application
                scopes:
                  - read
                  - write
        '400':
          description: Bad request - invalid verification code or parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_code:
                  summary: Invalid verification code
                  value:
                    error: Invalid verification code
                    codes:
                      - code: INVALID_MFA_CODE
                        field: verification_code
                        description: The verification code provided is incorrect
                expired_code:
                  summary: Expired verification code
                  value:
                    error: Verification code expired
                    codes:
                      - code: EXPIRED_MFA_CODE
                        field: verification_code
                        description: >-
                          The verification code has expired (typically after 10
                          minutes)
        '401':
          description: Unauthorized - authentication failed or too many attempts
        '500':
          description: Internal server error
      x-codeSamples:
        - lang: java
          label: Java (SDK)
          source: >-
            package hello.world;


            import java.lang.Exception;

            import org.openapis.openapi.AriesJava;

            import org.openapis.openapi.models.errors.ErrorResponse;

            import
            org.openapis.openapi.models.operations.Oauth2TokenAuthorizeMFARequest;

            import
            org.openapis.openapi.models.operations.Oauth2TokenAuthorizeMFAResponse;


            public class Application {

                public static void main(String[] args) throws ErrorResponse, Exception {

                    AriesJava sdk = AriesJava.builder()
                            .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
                        .build();

                    Oauth2TokenAuthorizeMFARequest req = Oauth2TokenAuthorizeMFARequest.builder()
                            .nextStepAuthId("auth_mfa_123abc")
                            .verificationCode("123456")
                            .build();

                    Oauth2TokenAuthorizeMFAResponse res = sdk.oAuth2().authorizeMFA()
                            .request(req)
                            .call();

                    if (res.object().isPresent()) {
                        // handle response
                    }
                }
            }
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
        codes:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                description: Error code
              description:
                type: string
                description: Error description

````