Forum Discussion

tektez's avatar
tektez
Occasional Visitor
4 years ago

SwaggerHub Cookie Authentication

I am using the OpenAPI V3.0 and try to authenticate with User Name and Password. REST API supposed to return a Token and 4 cookies. I can see those when I use the Postman. In SwaggerHub, I got the Token in teh "Response Body" section. However I do not see any of the cookies. I included the Settings of the SH file. Original one is properly indented.

 

I attached the screen shots from postman and SwaggerHub pointing out what is missing in the SH.

 

My question is, how do you get access to the Cookies returned from the server(If they are returned ever...)?

 

Configuration is as follows:

==================================
openapi: 3.0.0
servers:
- url: <COMPANY_URL_GOES_HERE>
info:
description: < DESCRIPTION GOES HERE>
version: 1.0.0
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html

# tags are used for organizing operations
tags:
- name: admins
description: Secured Admin-only calls
- name: developers
description: Operations available to regular developers
components:
securitySchemes:
cookieAuth: # arbitrary name for the security scheme; will be used in the "security" key later
type: apiKey
in: cookie
name: JSESSIONID # cookie name
security:
- cookieAuth: []
paths:
/api/auth/login:
post:
description: Logs in the user and creates a Token
security:
- cookieAuth: []
parameters:
- in: header
name: JSESSIONID
schema:
type: string
enum: []
required: true
- in: query
name: siteId
style: form
schema:
type: string
type: string
description: Site ID
- in: query
name: memberEmail
style: form
schema:
type: string
description: User Name.
- in: query
name: password
schema:
type: string
style: form
description: Login Password
responses:
'201':
description: Successfully authenticated.
The session ID is returned in a cookie named `JSESSIONID`. You need to include this cookie in subsequent requests.
headers:
Set-Cookie:
schema:
type: string
example: JSESSIONID=abcde12345; Path=/; HttpOnly

No RepliesBe the first to reply