> ## 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 Confirm

> Confirms user authorization and generates authorization code. This endpoint completes the authorization flow by confirming the user's consent and generating an authorization code. The authorization code can then be exchanged for access and refresh tokens using the /v1/oauth2/token endpoint.



## OpenAPI

````yaml https://spec.speakeasy.com/aries/aries/aries-trading-platform-api-with-code-samples post /v1/oauth2/authorize/confirm
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/confirm:
    post:
      tags:
        - OAuth2
      summary: OAuth2 Authorize Confirm
      description: >-
        Confirms user authorization and generates authorization code. This
        endpoint completes the authorization flow by confirming the user's
        consent and generating an authorization code. The authorization code can
        then be exchanged for access and refresh tokens using the
        /v1/oauth2/token endpoint.
      operationId: oauth2_Authorize_Confirm
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                next_step_auth_id:
                  type: string
                  description: >-
                    Authorization session ID from previous step
                    (/v1/oauth2/authorize or /v1/oauth2/authorize/mfa)
                  example: auth_confirm_456def
              required:
                - next_step_auth_id
            example:
              next_step_auth_id: auth_confirm_456def
        required: true
      responses:
        '200':
          description: Authorization confirmed, code generated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: >-
                      Single-use authorization code to exchange for tokens
                      (expires in ~10 minutes)
                  redirect_uri:
                    type: string
                    format: uri
                    description: Redirect URI registered with the client
                required:
                  - code
                  - redirect_uri
              example:
                code: auth_code_abc123xyz789def456
                redirect_uri: https://yourapp.com/callback
        '400':
          description: Bad request - invalid or expired next_step_auth_id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Invalid authorization session
                codes:
                  - code: INVALID_AUTH_SESSION
                    field: next_step_auth_id
                    description: The authorization session is invalid or has expired
        '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.Oauth2AuthorizeConfirmRequest;

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


            public class Application {

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

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

                    Oauth2AuthorizeConfirmRequest req = Oauth2AuthorizeConfirmRequest.builder()
                            .nextStepAuthId("auth_confirm_456def")
                            .build();

                    Oauth2AuthorizeConfirmResponse res = sdk.oAuth2().authorizeConfirm()
                            .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

````