oauthenticator icon indicating copy to clipboard operation
oauthenticator copied to clipboard

[Generic] Using OAUTH2_AUTHORIZE_URL results in incorrect authorize URL

Open westernspion opened this issue 3 years ago • 1 comments

Bug description

Using OAUTH2_AUTHORIZE_URL seems to improperly construct the authorize URL used in the login process. It seems to prepend the base URL (in my case, localhost:8000/hub/) to the actual authorize URL, resulting in a 404 not found.

When setting directly through Jupyter config file, as c.GenericOAuthenticator.authorize_url = "https://acme.okta.com/oauth2/<redacted>/v1/authorize?scope=openid email it works as expected and I am redirected to my Okta OAuth provider as expected.

Expected behaviour

Using OAUTH2_AUTHORIZE_URL should not concatenate the base URL to the authorize endpoint. It should behave the same way as the Jupyterhub c.GenericOAuthenticator.authorize_url parameter

Example

When set with OAUTH2_AUTHORIZE_URL environment variable, after clicking the sign in with my provider link from Jupyterhub I get directed to this URL, which results in a 404 with Jupyterhub since this URL doesn't exist http://localhost:8000/hub/%22https://acme.okta.com/oauth2/<redacted>/v1/authorize?scop..... ^ Removing the base url manually completes the sign in process

But when I use the parameter through Jupyterhubs config it works as expected https://acme.okta.com/oauth2/<redacted>/v1/authorize?scop.....

Setup Python 3.8.13 jupyterhub 2.3.1 jupyterlab 3.4.4 amazonlinux:2 container

westernspion avatar Jul 21 '22 17:07 westernspion

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar Jul 21 '22 17:07 welcome[bot]