You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With SpringDoc using the actuator management port and an endpoint that expects an unauthorized response (401), unauthorized responses show an "Undocumented" code with details
Failed to fetch.
Possible Reasons:
CORS
Network Failure
URL scheme must be "http" or "https" for CORS request.
I would expect to see a "401" code with details "Unauthorized"
To Reproduce
Steps to reproduce the behavior:
Clone this repo: git clone https://github.com/mrgrew/swagger-auth-cors
Change to the repo directory and run it: ./gradlew bootRun
In a browser, navigate to http://localhost:9090/actuator/swagger-ui
Authorize with Bearer api-key
Open the "/api" endpoint and click "Execute".
You'll see a 200 status code with response {}
Use the Authorize button to "Logout"
Click "Execute" again and see an "Undocumented" code with details "Failed to fetch."
Expected output would be a "401" code with details "Unauthorized"
The demo above uses Spring Boot 3.1.2 and springdoc-openapi-starter-webflux-ui version 2.1.0.
Expected behavior
I expect a 401 response status code to appear as "401 Unauthorized", not "Undocumented Failed to fetch"
The text was updated successfully, but these errors were encountered:
Thanks for taking a look. The example I provide doesn't use OAuth2 so it seems my issue may be different.
I should add that once I put my API behind a Kubernetes Ingress, headers were added to the response and SpringDoc showed a "401" code with "Error: response status is 401" details rather than a failure indicating a CORS error.
The MDN Docs for 401 state a 401 response should return a "WWW-Authenticate" header. My example Spring Secuirty configuration doesn't return ANY headers - I wonder if that's what is causing the unexpected behavior.
I'm starting to think a 403 status would be a better response for this situation. I hope to have time to try that out.
Describe the bug
With SpringDoc using the actuator management port and an endpoint that expects an unauthorized response (401), unauthorized responses show an "Undocumented" code with details
I would expect to see a "401" code with details "Unauthorized"
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/mrgrew/swagger-auth-cors
./gradlew bootRun
http://localhost:9090/actuator/swagger-ui
Bearer api-key
{}
The demo above uses Spring Boot 3.1.2 and springdoc-openapi-starter-webflux-ui version 2.1.0.
Expected behavior
I expect a 401 response status code to appear as "401 Unauthorized", not "Undocumented Failed to fetch"
The text was updated successfully, but these errors were encountered: