flask-restx icon indicating copy to clipboard operation
flask-restx copied to clipboard

Support configurable OAUTH redirect URLs

Open thedumbterminal opened this issue 2 years ago • 7 comments

Is your feature request related to a problem? Please describe. Currently when using oauth the redirect URL is hardcoded here:

https://github.com/python-restx/flask-restx/blob/master/flask_restx/templates/swagger-ui.html#L55

The included oauth2-redirect.html is fine unless you are implementing OAUTH on the server side where you need logic such as creating a user account etc.

Describe the solution you'd like I'd like to set my own OAUTH redirect URL so after the OAUTH dance I can create user accounts, for example using flask-security. This could be done via an flask app config setting.

Describe alternatives you've considered Did briefly consider how to redirect the default swagger redirect URL, but it seems wrong to use it for anything other than documentation needs.

Additional context Example of using flask-dance for oauth to allow specific OAUTH handlers:

https://github.com/singingwolfboy/flask-dance-github

I've got a working branch here, which I can submit a PR for if the feature is accepted:

https://github.com/python-restx/flask-restx/compare/master...thedumbterminal:oauth-redirect?expand=1

thedumbterminal avatar May 14 '22 08:05 thedumbterminal

Ran into this exact same problem today, hope to see a fix.

zachanator070 avatar Jun 05 '22 03:06 zachanator070

Just raised the PR for the branch with my change in the hope that it gets noticed.

thedumbterminal avatar Jun 05 '22 07:06 thedumbterminal

Hi @j5awry are you able to give any feedback on this issue, or review the linked PR? Thanks.

thedumbterminal avatar Jun 09 '22 19:06 thedumbterminal

HI @ziirish are you take a review on the PR or point me in the direction of someone else who can? thanks

thedumbterminal avatar Dec 13 '22 21:12 thedumbterminal

@peter-doggart are you able to review this?

thedumbterminal avatar Mar 12 '24 09:03 thedumbterminal

@thedumbterminal This is on my to-do list. Just haven't had a chance to do any updates lately, but I will make sure this makes it into the next release.

peter-doggart avatar Apr 01 '24 09:04 peter-doggart

Thanks 🙏

thedumbterminal avatar Apr 01 '24 19:04 thedumbterminal