gin-swagger
gin-swagger copied to clipboard
oauth2 authorization code oauth2-redirect.html
redirect not found
http://localhost:8080/oauth2-redirect.html?code=e9hHdQBGAMIK&state=TW9uIEp1biAyOSAyMDIwIDExOjA1OjM4IEdNVCswODAwICjkuK3lm73moIflh4bml7bpl7Qp
redirect ok
http://localhost:8080/swagger/oauth2-redirect.html?code=e9hHdQBGAMIK&state=TW9uIEp1biAyOSAyMDIwIDExOjA1OjM4IEdNVCswODAwICjkuK3lm73moIflh4bml7bpl7Qp
Unable to configure
Related PR: https://github.com/swaggo/gin-swagger/pull/92
Hi, what happens with this issue? I cannot configure the redirect_uri :(
The difference between http://localhost:8080/oauth2-redirect.html
and http://localhost:8080/swagger/oauth2-redirect.html
Here's how I solved it: https://github.com/nilorg/naas/blob/92e3cff2a821fb82797a875d8e0111e7a6d9360e/internal/pkg/gin-swagger/swagger.go
https://github.com/nilorg/naas/blob/92e3cff2a821fb82797a875d8e0111e7a6d9360e/internal/pkg/gin-swagger/swagger.go#L237
Issues related: https://github.com/swaggo/swag/issues/595 https://github.com/swaggo/gin-swagger/pull/92
So, is it necessary to rewrite internal package code?
Other authors' pull request was not applied.
I referred to their code and made changes myself. It would solve my problem at the time
Google Translate
@DeyiXu, the PR has a merge conflict, and the author didn't respond on time. A PR regarding this matter is always welcome, and I will be more than happy to assist you with a CR. On the other side, rendering the Oauh2 appID and AppSecret on the HTML is not secure, but I assume this would be only for testing purposes.
I think his idea is to request the redirect_uri
param on the authorization form. Have you got another idea about how to render the oauth2-redirect.html
into the designed path in gin?
@alvarogf97, any contribution is welcome. Unfortunately, I don't have enough spare time to work on this, but it will be a pleasure to assist you with a code review.