gin-swagger icon indicating copy to clipboard operation
gin-swagger copied to clipboard

oauth2 authorization code oauth2-redirect.html

Open DeyiXu opened this issue 4 years ago • 8 comments

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

DeyiXu avatar Jun 29 '20 03:06 DeyiXu

Related PR: https://github.com/swaggo/gin-swagger/pull/92

DeyiXu avatar Jun 29 '20 03:06 DeyiXu

Hi, what happens with this issue? I cannot configure the redirect_uri :(

alvarogf97 avatar Nov 02 '21 08:11 alvarogf97

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

DeyiXu avatar Nov 02 '21 08:11 DeyiXu

So, is it necessary to rewrite internal package code?

alvarogf97 avatar Nov 02 '21 08:11 alvarogf97

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 avatar Nov 02 '21 09:11 DeyiXu

@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.

ubogdan avatar Nov 02 '21 21:11 ubogdan

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 avatar Nov 03 '21 16:11 alvarogf97

@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.

ubogdan avatar Nov 03 '21 19:11 ubogdan