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

oauth2-redirect.html with query parameters return 404 #106

Open
rytsh opened this issue May 21, 2023 · 2 comments · May be fixed by #123
Open

oauth2-redirect.html with query parameters return 404 #106

rytsh opened this issue May 21, 2023 · 2 comments · May be fixed by #123

Comments

@rytsh
Copy link

rytsh commented May 21, 2023

Hi, when I try to login oauth2 feature, it is redirection to this URL:

http://localhost:3000/swagger/oauth2-redirect.html?state=U3X..

But when I checked, if any query parameters go to this html oauth2-redirect.html route not found and return 404.

This should be bug and need to fix the route, serve steps.

v1.3.5 works fine with oauth2 redirection.

@komron-m
Copy link

komron-m commented Sep 20, 2023

I faced the same issue, the bug is in default case of switch statement of swagger.go, line 191
image

I suggest creating a fork and changing code in default case to:

parsedUrl, err := url.Parse(matches[2])
if err != nil {
    c.Error(err)

    return nil
}
c.Request().URL = parsedUrl
http.FileServer(http.FS(swaggerFiles.FS)).ServeHTTP(c.Response(), c.Request())

BTW: this issue is mentioned also here: swaggo/swag#1117

reidlevesque added a commit to groq/echo-swagger that referenced this issue Jul 31, 2024
reidlevesque added a commit to reidlevesque/echo-swagger that referenced this issue Jul 31, 2024
@reidlevesque reidlevesque linked a pull request Jul 31, 2024 that will close this issue
@reidlevesque
Copy link

I made a PR for the suggested fix after testing it successfully in my fork.

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 a pull request may close this issue.

3 participants