Forum Discussion

ozfarooq's avatar
ozfarooq
New Member
2 months ago

SwaggerHub CORS Error

I am facing CORS related error. The CORS has been configured on the server side. However when i try to execute an endpoint from SwaggerHUB. I get the below error

I have installed a chrome extension to disable cors and this works fine. I need to make it work without any chrome extension. What changes i have to do in my OAS file. 

Here is the endpoint definition in OAS.

/api/login:
    post:
      tags:
        - Login
      summary: User login
      description: Authenticate a user and generate a JWT token for authentication.
      operationId: login
      parameters:
        - name: "x-api-key"
          in: "header"
          required: false
          schema:
            type: "string"
      requestBody:
        description: User credentials
        required: true
        content:
          application/json:
            schema:
              properties:
                email:
                  type: string
                  format: email
                  example: itei.test6@gmail.com
                password:
                  type: string
                  format: password
                  example: '123456789'
                company_id:
                  type: string
                  format: company_id
                  example: 17
              type: object

 

1 Reply

  • KF4UYC's avatar
    KF4UYC
    New Contributor

    ozfarooq, did you ever find a solution for this issue...I am experiencing the same one...trying to test my first path...

    -----Jim