Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: consume swagger api with CSRF #156

Merged
merged 1 commit into from
May 1, 2022
Merged

Conversation

saadjutt01
Copy link
Member

Cookie Authentication on Swagger UI is not supported

Note for Swagger UI and Swagger Editor users: Cookie authentication is currently not supported for "try it out" requests due to browser security restrictions. See this issue for more information. SwaggerHub does not have this limitation.

Ref: https://swagger.io/docs/specification/authentication/cookie-authentication/

Implemented request intercepter to manually add CSRF in headers.

const csrf = cookie.slice(startIndex + 11).split('; ')[0]
request.headers['X-XSRF-TOKEN'] = csrf
return request
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request intercepter for swagger to attach CSRF token in request.headers

@allanbowe allanbowe merged commit c9d66b8 into main May 1, 2022
@allanbowe allanbowe deleted the fix-swagger-api-with-csrf branch May 1, 2022 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants