conradbez / streamlit-auth0 Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
User info comes through, but then a big error box is printed:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.__dict__)
File "/app/deep_digest/app.py", line 12, in <module>
user_info = login_button(settings.AUTH0_CLIENT_ID, domain=settings.AUTH0_DOMAIN)
File "/usr/local/lib/python3.10/site-packages/auth0_component/__init__.py", line 82, in login_button
elif isAuth(response = user_info, domain = domain):
File "/usr/local/lib/python3.10/site-packages/auth0_component/__init__.py", line 89, in isAuth
return getVerifiedSubFromToken(token = response['token'], domain=domain) == response['sub']
File "/usr/local/lib/python3.10/site-packages/auth0_component/__init__.py", line 28, in getVerifiedSubFromToken
raise ValueError
ValueError
domain should end with ".us.auth0.com" (no slash)
Problem is here:
This works great for use cases in which you have the same level of permission for all users, but if for instance you want to have different roles per user which entitles different functionalities, just grabbing the user basic info might require additional work, could you also get the user's metadata? that way you can set-up the custom attributes for your users and get it directly just using this library
Hi, I tried to run this package but got and error. I installed with pip install streamlit-auth0-component
The code is
from auth0_component import login_button
import streamlit as st
user_info = login_button(XXX, domain=XXX)
st.write(user_info)
The error
2022-10-12 14:58:48.291 Uncaught app exception
Traceback (most recent call last):
File "/home/.venv/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 562, in _run_script
exec(code, module.__dict__)
File "/home/auth0_app.py", line 1, in <module>
from auth0_component import login_button
File "/home/.venv/lib/python3.8/site-packages/auth0_component/__init__.py", line 16, in <module>
_login_button = components.declare_component("login_button", path=build_dir)
File "/home/.venv/lib/python3.8/site-packages/streamlit/components/v1/components.py", line 300, in declare_component
ComponentRegistry.instance().register_component(component)
File "/home/.venv/lib/python3.8/site-packages/streamlit/components/v1/components.py", line 340, in register_component
raise StreamlitAPIException(f"No such component directory: '{abspath}'")
streamlit.errors.StreamlitAPIException: No such component directory: '/home/.venv/lib/python3.8/site-packages/auth0_component/frontend/dist'
Thanks a lot for this much needed component!
The component works flawlessly if you make a Single Page Application with the "New" universal login. However, the "New" universal login (Branding > Universal Login > New) has problems with SSO as noted here https://community.auth0.com/t/no-connections-enabled-for-the-client-but-saml-connection-is-enabled/62759.
If you use the "Classical" universal login the component starts breaking with Login required
(some context on when that happens on auth0 here https://community.auth0.com/t/failed-silent-auth-login-required/33165/38).
To reproduce it all you need to do is go to Branding > Universal Login and select Classical. The same app breaks.
Any ideas on how to go around it? Plans on supporting it?
user_info is returning a boolean, and after authentication, it does not turn true.
running simple app in auth0
I can run this component in dev - works great!
But deploying to prod (on fly.io), I get this error ("Your app is having trouble loading the auth0_component.login_button component.")
The frontend code is correctly copied to the server, and I'm able to import the python module. Maybe it's a network issue? Does a new port need to be forwarded for a separate process serving the html/ javascript?
Any ideas? Thank you!!
Would you remove the domain check on line 26 of init.py? It would allow us to work with Auth0 from different regions. My auth0 domain is just .auth0.com
Thanks for the awsome repo,
I have a similar use case where I have to deploy the streamlit app with auth0 on was.
Could you please guide me, on how to deploy the application in aws?
When attempting to log out, even though on the streamlit app everything works fine, the pop-up window remains open.
Is there a way to change the border color of the Login/Logout button? I would prefer it if it would look like a normal button.
Just delete the following line of code or modify it to allow others domains
It just worked for my. That harcoded line must be deleted or modified to handle other domains.
EDIT:
My bad - window will appear blank if the domain is not properly set.
I have a simple streamlit app with 2 pages (A and B) and used the login_button component in either pages. When the login is done in the A page the component shows the logout text and allows the user to logout the session.
However when the user changes to page B, the login_button instantiated in that page doesn't maintain the logged in state, and another message to login is shown.
PS: I have instantiated the login button using the key optional parameter as "login" in both pages.
Is there any way to keep the component state even if the user changed page after the login?
I am available to help with development if necessary. Although I'm not an experienced programmer, I'm willing to help,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.