# Authorization

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /connect/token:
    post:
      summary: Authorization
      deprecated: false
      description: สำหรับขอ access token
      tags:
        - Venio/Authentication API
      parameters:
        - name: Content-Type
          in: header
          description: ' Content type of request payload Value: - application/x-www-form-urlencoded'
          required: true
          example: application/x-www-form-urlencoded
          schema:
            type: string
        - name: Ocp-Apim-Subscription-Key
          in: header
          description: รหัส subscription key ของลูกค้า
          required: true
          example: <Your-Subscription-Key>
          schema:
            type: string
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                grant_type:
                  description: >-
                    ประเภทของ Grant Types ใน OAuth 2.0 (client_credentials
                    เท่านั้น)
                  example: client_credentials
                  type: string
                client_id:
                  description: ' API client_id respective to each partner obtained from partner onboarding process :api cliend_id ที่เกี่ยวข้องตามแต่ละpartnerที่ได้รับในขั้นตอนเริ่มต้น onboarding'
                  example: <Your-Client-Id>
                  type: string
                client_secret:
                  description: ' API client_secret obtained from partner onboarding process: api cliend_secret ที่ได้รับจาก partnerในขั้นตอนเริ่มต้น onboarding'
                  example: <Your-Client-Secret>
                  type: string
              required:
                - grant_type
                - client_id
                - client_secret
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                    description: access token
                  token_type:
                    type: string
                    description: ประเภท token
                  expires_in:
                    type: integer
                    description: ระยะเวลาของ token
                  scope:
                    type: string
                    description: ขอบเขต
                x-apidog-orders:
                  - access_token
                  - token_type
                  - expires_in
                  - scope
                required:
                  - access_token
                  - token_type
                  - expires_in
                  - scope
              example:
                access_token: string
                expires_in: 1
                token_type: Bearer
                scope: string
          headers: {}
          x-apidog-name: OK
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: error เกี่ยวกับอะไร
                  error_description:
                    type: string
                    description: คำอธิบาย error
                x-apidog-orders:
                  - error
                  - error_description
                required:
                  - error
              example:
                error: invalid_grant
                error_description: Invalid user login
          headers: {}
          x-apidog-name: Bad Request
        '401':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: integer
                    description: "สถานะ\_code\_ของ\_httpเช่น200\_Ok201\_Created400\_BadRequest401\_Unauthorized404\_Record\_not\_found500\_Internal\_Server\_Error"
                  message:
                    type: string
                    description: คำบรรยาย error
                x-apidog-orders:
                  - statusCode
                  - message
                required:
                  - statusCode
                  - message
              example:
                statusCode: 401
                message: >-
                  Access denied due to invalid subscription key. Make sure to
                  provide a valid key for an active subscription.
          headers: {}
          x-apidog-name: Unauthorized
      security:
        - bearerAuth: []
          x-apidog:
            schemeGroups:
              - id: uyL_cJmK7q60QJZRTi5ot
                schemeIds:
                  - bearerAuth
            required: true
            use:
              id: uyL_cJmK7q60QJZRTi5ot
            scopes:
              uyL_cJmK7q60QJZRTi5ot:
                bearerAuth: []
      x-apidog-folder: Venio/Authentication API
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/351895/apis/api-3590380-run
components:
  schemas: {}
  securitySchemes:
    bearerAuth:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      description: ใส่ JWT Token ในรูปแบบ Bearer {token}
    bearer:
      type: bearer
      scheme: bearer
servers:
  - url: https://api.gofive.co.th
    description: Production
security:
  - bearerAuth: []
    x-apidog:
      schemeGroups:
        - id: uyL_cJmK7q60QJZRTi5ot
          schemeIds:
            - bearerAuth
      required: true
      use:
        id: uyL_cJmK7q60QJZRTi5ot
      scopes:
        uyL_cJmK7q60QJZRTi5ot:
          bearerAuth: []

```
