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

OAuth login includes prefix twice in the login url #5492

Closed
kuykendall-ben opened this issue Sep 8, 2023 · 0 comments · Fixed by #5514
Closed

OAuth login includes prefix twice in the login url #5492

kuykendall-ben opened this issue Sep 8, 2023 · 0 comments · Fixed by #5514
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@kuykendall-ben
Copy link

Minor bug related to #5422. The login endpoint configured with OAuth is now /<prefix>/<prefix>/login which appears to work, but can't possibly be the intended path.

ALL software version info

Panel: 1.2.2
Bokeh: 3.2.0
Tornado: 6.2
Python: 3.10.13
OAuth provider: GitHub
Platform: macOS Ventura 13.5.1

Description of expected behavior and the observed behavior

Visiting http://localhost:5006/prefix/app should redirect to http://localhost:5006/prefix/login to start the authentication flow. Instead it redirects to http://localhost:5006/prefix/prefix//login. Login does proceed correctly.

Complete, minimal, self-contained example code that reproduces the issue

Create an OAuth app in GitHub per https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app. Set the "authorization callback URL" to http://localhost:5006/prefix/. Generate a "client secret", and save the key and secret for use below.

Write a minimal app.py

import panel as pn
pn.Column('test').servable()

Start the panel server with OAuth parameters and a prefix. Make sure to include the prefix (including the trailing /) in the OAuth redirect uri

panel serve app.py --port 5006  --cookie-secret `panel secret` \
  --oauth-provider github --oauth-key $KEY --oauth-secret $SECRET \
  --oauth-redirect-uri http://localhost:5006/prefix/ \
  --prefix prefix

Visit http://localhost:5006/prefix/app. It will redirect to http://localhost:5006/prefix/prefix//login?next=/prefix/app. The authentication flow will start; optionally sign in with GitHub and eventually get redirected to http://localhost:5006/prefix/app. Verify the page renders.

Screenshots or screencasts of the bug in action

Included are screenshots of the first two requests in the authentication flow.

The initial GET /prefix/app request returns with a redirect to ./prefix//login?next=/prefix/app

Screenshot 2023-09-08 at 11 32 46 AM

This resolves to GET /prefix/prefix//login (?!) which redirects to the OAuth provider as desired

Screenshot 2023-09-08 at 11 32 55 AM
@philippjfr philippjfr added the type: bug Something isn't correct or isn't working label Sep 11, 2023
@philippjfr philippjfr added this to the v1.2.3 milestone Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants