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

# Request device authorization code

> Request a device authorization code for OAuth2 device flow



## OpenAPI

````yaml openapi.yaml post /oauth2/device/code
openapi: 3.0.0
info:
  title: Open API
  version: v1
  contact:
    name: Sparkle
    email: support@sparkle.ng
    url: https://sparkle.ng
  description: >
    The Regulatory Framework for Open Banking in Nigeria established principles
    for data sharing across the banking and payments system to promote
    innovations and broaden the range of financial products and services
    available to bank customers. As a result, open banking recognizes the
    ownership and control of data by customers of financial and non-financial
    services, and their right to grant authorizations to service providers for
    the purpose of accessing innovative financial products and services.


    ## What this document is about

    This is a draft of the API specification standards designed to be used in
    compliance with the Central Bank of Nigeria (CBN) operational guidelines on
    open banking within the Nigerian financial ecosystem.


    ## Scope

    Given the open banking proposition, any organisation that has data of
    customers which may be exchanged with other entities for the purpose of
    providing innovative financial services within Nigeria, is eligible to
    participate in the Open Banking ecosystem.


    ## Authentication

    Authorization to API endpoints is performed using OAuth 2.0 Client
    Credentials flow.


    https://apis.openbanking.ng/#d9bd2beb-bb24-4ac3-95c4-7fc3d4f486c3
servers:
  - url: '{authUrl}'
    variables:
      authUrl:
        default: https://identity-sandbox.sparkle.fyi
        description: Authentication URL
  - url: '{apiUrl}'
    variables:
      apiUrl:
        default: https://api-sandbox.sparkle.fyi/openapi/v1
        description: Base URL for the API
security: []
tags:
  - name: DynamicClientRegistration
    description: Dynamic client registration endpoints
  - name: Consent
    description: Authentication and authorization endpoints
  - name: Meta
    description: Meta information endpoints
  - name: Health
    description: Health check endpoints
  - name: Customers
    description: Customer management endpoints
  - name: Accounts
    description: Account management endpoints
  - name: Transfers
    description: Transaction and transfer related endpoints
  - name: Bill Payments
    description: Bill payment related endpoints
  - name: Disputes
    description: Dispute management endpoints
  - name: Direct Debits
    description: Direct debit management endpoints
  - name: Cards
    description: Card management and transaction endpoints
  - name: Loans
    description: Loan management endpoints
  - name: Savings
    description: Savings management endpoints
paths:
  /oauth2/device/code:
    post:
      tags:
        - Consent
      summary: Request device authorization code
      description: Request a device authorization code for OAuth2 device flow
      operationId: requestDeviceCode
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - client_id
                - scope
              properties:
                client_id:
                  type: string
                  description: The client identifier
                  example: '{{CLIENT_ID}}'
                scope:
                  type: string
                  description: Space-separated list of requested scopes
                  example: openid profile email
                target_connection_id:
                  type: string
                  description: The target connection ID for authorization
                  example: CONN0987654321
      responses:
        '200':
          description: Device authorization code generated successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - device_code
                  - user_code
                  - verification_uri
                  - interval
                  - expires_in
                  - obn_custom_metadata
                properties:
                  device_code:
                    type: string
                    description: The device verification code
                    example: req_id_0987654321
                  user_code:
                    type: string
                    description: The user verification code
                    example: BZ4K8
                  verification_uri:
                    type: string
                    description: The URI where the user should enter the user_code
                    example: https://auth.example.com/activate
                  interval:
                    type: integer
                    description: The polling interval in seconds
                    example: 5
                  expires_in:
                    type: integer
                    description: The expiration time in seconds
                    example: 900
                  obn_custom_metadata:
                    type: object
                    required:
                      - consent_validation_method
                      - consent_message
                      - consent_status
                    properties:
                      consent_validation_method:
                        type: string
                        description: The method used for consent validation
                        example: OAUTH2
                      consent_message:
                        type: string
                        description: Message displayed to the user about consent
                        example: >-
                          You will be redirected to
                          https://auth.example.com/activate. Provide your
                          details there to grant consent
                      consent_status:
                        type: string
                        description: Current status of the consent
                        example: PENDING_VALIDATION

````