Wrong oauth2-redirect.html path using OAuth2 Code flow
See original GitHub issueDescribe the bug
This sounds very like https://github.com/springdoc/springdoc-openapi/issues/340 . We are using openapi-ui version 1.2.30 and have an OAuth2 secured API (Authorization code flow).
When we use the authorize button in Swagger-UI after logging in we get redirected to something like http://localhost:8080/oauth2-redirect.html
. Notice that the /swagger-ui
part is missing in the path.
We use the generated Openapi Spec (/v3/api-docs
).
The content of /v3/api-docs/swagger-config
is:
{
"configUrl":"/v3/api-docs/swagger-config",
"oauth2RedirectUrl":"http://localhost:8088/swagger-ui/oauth2-redirect.html",
"url":"/v3/api-docs",
"validatorUrl":""
}
The securityScheme
config in the spec looks like this:
"securitySchemes":{
"oauth2":{
"type":"oauth2",
"in":"header",
"bearerFormat":"jwt",
"flows":{
"authorizationCode":{
"authorizationUrl":"https://localhost:9002/authorizationserver/oauth/authorize",
"tokenUrl":"http://localhost:8080/oauth/token"
}
}
}
}
To Reproduce Steps to reproduce the behavior:
- What version of spring-boot you are using? 2.2.4.RELEASE
- What modules and versions of springdoc-openapi are you using? org.springdoc:springdoc-openapi-ui:1.2.30’
Expected behavior
I would expect to be redirected to http://localhost:8080/swagger-ui/oauth2-redirect.html
after logging in at the OAuth2 provider.
Additional info
Can you point me in a direction where to debug to further investigate the issue? Or is my config simply wrong?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
Are you using any configuration properties ? Difficult to answer you without providing a sample project to reproduce (MCVE).
Hi @patst, did you find a solution ? , I’ve the same problem the oauth login box is loaded with the parameter
&redirect_uri=http:%2F%2Flocalhost:5000%2Foauth2-redirect.html
which result in a 404 on http://localhost:5000/oauth2-redirect.html?code=xxxhere is my swagger-config
{ "configUrl": "/v3/api-docs/swagger-config", "oauth2RedirectUrl": "http://localhost:5000/swagger-ui/oauth2-redirect.html", "url": "/v3/api-docs", "validatorUrl": "" }