Forum Discussion

MasterTesh's avatar
MasterTesh
Occasional Contributor
3 years ago

cookies authentication

Hi everyone hope you are doing well,

I would like to achieve as below in c#, but I have no idea how to do it

  1. paths:
  2. /login:
  3. post:
  4. summary: Logs in and returns the authentication cookie
  5. requestBody:
  6. required: true
  7. description: A JSON object containing the login and password.
  8. content:
  9. application/JSON:
  10. schema:
  11. $ref: '#/components/schemas/LoginRequest'
  12. security: [] # no authentication
  13. responses:
  14. '200':
  15. description: >
  16. Successfully authenticated.
  17. The session ID is returned in a cookie named `JSESSIONID`. You need to include this cookie in subsequent requests.
  18. headers:
  19. Set-Cookie:
  20. schema:
  21. type: string
  22. example: JSESSIONID=abcde12345; Path=/; HttpOnly