Forum Discussion

vcbayashu's avatar
vcbayashu
New Contributor
2 years ago

Cookie not receiving at backend server

Hi I am using swagger docs for developing API documentation for my application. It is working fine for unauthorized apis but not on secured apis where cookies are needed. I have setup cookie authorization on swagger by looking into docs and I can see the cookie is set on the curl command but the cookie is not recieved at the backend server.Also curl command is working fine on gitbash.

 

  • chichepo's avatar
    chichepo
    Champion Level 1

    vcbayashu 
    I am not sure if it is related to your API definition or swaggerHub.
    You can design your API behavior, by adding cookies, but maybe the server does not allow any cookie inputs.
    I would suggest you to check the server settings for inbound traffic.

    • vcbayashu's avatar
      vcbayashu
      New Contributor

      I am running my swagger ui server on localhost:4000 and my other server which contains the routes to be documented are running on port 5000. All the other apis which does not require cookies are running smooth. I did the configuration for cookie auth and gave correct cookie names and values and then tried to execute the api but the cookie isn't recieved at backend server. I manually hardcoded an axios call to the server on the same swagger file on port 4000 providing the cookies then cookies were received at port 5000. On the swagger UI also I could see the curl command contains corrrect cookies, also the curl command works fine on gitbash but not on swagger UI. Can you help me in someway?