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

Fix oauth2-redirect outside of the base swagger path #177

Merged
merged 5 commits into from
Nov 4, 2021

Conversation

alvarogf97
Copy link
Contributor

@alvarogf97 alvarogf97 commented Nov 4, 2021

Problem

When you use Oaut2 implicit flow, swagger ui sends an url that not includes the path where the swagger ui is located to the authorization page

If you include swaggo in your project like this:

router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))

You will get this redirect url in the oauth2 implicit flow:

{protocol}//{host}/oauth2-redirect.html

This url is not found due to his location is {protocol}//{host}/swagger/oauth2-redirect.html
actually

Relation issue
The issue is #115

Additional context
I add the minimun changes to make it work.

PD: sorry for the other changes fmt did his work :D and I think it could be worth

cc: @ubogdan @DeyiXu

The following images belong to my own project that can be a proof of how it works
url1
url2

Sorry for my broken english, I'm from Spain :D

@codecov
Copy link

codecov bot commented Nov 4, 2021

Codecov Report

Merging #177 (c040683) into master (7da8e84) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #177   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           70        81   +11     
=========================================
+ Hits            70        81   +11     
Impacted Files Coverage Δ
swagger.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7da8e84...c040683. Read the comment docs.

Copy link
Contributor

@ubogdan ubogdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ubogdan ubogdan merged commit 498deb2 into swaggo:master Nov 4, 2021
@ubogdan
Copy link
Contributor

ubogdan commented Nov 4, 2021

@alvarogf97 Thanks for your contribution.

@alvarogf97
Copy link
Contributor Author

thanks for merging @ubogdan

Could you create a new package release? Thanks!

@ubogdan
Copy link
Contributor

ubogdan commented Nov 4, 2021

added v1.3.3

@DeyiXu
Copy link

DeyiXu commented Nov 5, 2021

Thanks contribution

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 this pull request may close these issues.

3 participants