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

npm missnamed in server.py #3996

Closed
t-houssian opened this issue Oct 13, 2022 · 1 comment · Fixed by #4006
Closed

npm missnamed in server.py #3996

t-houssian opened this issue Oct 13, 2022 · 1 comment · Fixed by #4006

Comments

@t-houssian
Copy link
Contributor

Python 3.10.6
Panel 0.14

It appears that npm was misnamed in the DocHandler causing authentication to not work with pn.serve().

See line 330 in panel/io/server.py

Screenshot from 2022-10-13 14-13-05
Screenshot from 2022-10-13 16-09-13

npm_cdn=config.npn_cdn,

Needs to be

npm_cdn=config.npm_cdn,

A few steps are needed if you want to reproduce the error. But you should easily be able to see the typo.

Here is a reproducible example. You will have to use your own google web api credentials and add the correct redirect uri and your own encryption and cookie keys.

import panel as pn

def authorize(user_info):
        with open('users.txt') as f:
            valid_users = f.readlines()
        return user_info['email'] in valid_users

    pn.config.authorize_callback = authorize

def abc():
    return pn.pane.JSON({'abc': 123})

def bcd():
    return pn.pane.JSON({'bcd': 123})

template = pn.template.FastListTemplate(
    main=abc()
).servable()

template2 = pn.template.FastListTemplate(
    main=bcd()
).servable()

APP_ROUTES = {
    "/": template,
    "/bcd": template2
}

pn.serve(
    APP_ROUTES,
    port=5010,
    allow_websocket_origin=["127.0.0.1:5010"],
    address="127.0.0.1",
    show=True,
    autoreload=True,
    oauth_provider="google",
    oauth_key="KEY",
    oauth_secret="SECRET",
    oauth_encryption_key="k",
    cookie_secret="c",
    oauth_redirect_uri="http://127.0.0.1:5010/bcd"
)

I can open a merge request for this as well if needed.

@jbednar jbednar changed the title nmp missnamed in server.py npm missnamed in server.py Oct 13, 2022
@jbednar
Copy link
Member

jbednar commented Oct 13, 2022

Yes please! 🙂

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 a pull request may close this issue.

2 participants