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

Not working in streamlit 1.41.1? #45

Open
arnabneogi86 opened this issue Jan 2, 2025 · 5 comments · May be fixed by #48
Open

Not working in streamlit 1.41.1? #45

arnabneogi86 opened this issue Jan 2, 2025 · 5 comments · May be fixed by #48

Comments

@arnabneogi86
Copy link

I'm using streamlit version 1.41.1
msal_streamlit_authentication 1.1.0

note: same code is working fine with streamlit 1.37

Getting error
Traceback (most recent call last):
File "", line 1, in
File "c:\git\prtdata-ui\venv\Lib\site-packages\msal_streamlit_authentication_init_.py", line 28, in msal_authentication
authenticated_user_profile = _component_func(
^^^^^^^^^^^^^^^^
File "c:\git\prtdata-ui\venv\Lib\site-packages\streamlit\components\v1\custom_component.py", line 58, in call
return self.create_instance(
^^^^^^^^^^^^^^^^^^^^^
File "c:\git\prtdata-ui\venv\Lib\site-packages\streamlit\runtime\metrics_util.py", line 409, in wrapped_func
result = non_optional_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\git\prtdata-ui\venv\Lib\site-packages\streamlit\components\v1\custom_component.py", line 220, in create_instance
return_value = marshall_component(dg, element)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\git\prtdata-ui\venv\Lib\site-packages\streamlit\components\v1\custom_component.py", line 183, in marshall_component
computed_id = compute_and_register_element_id(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\git\prtdata-ui\venv\Lib\site-packages\streamlit\elements\lib\utils.py", line 219, in compute_and_register_element_id
element_id = _compute_element_id(
^^^^^^^^^^^^^^^^^^^^
File "c:\git\prtdata-ui\venv\Lib\site-packages\streamlit\elements\lib\utils.py", line 158, in _compute_element_id
h.update(user_key.encode("utf-8"))
^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'encode'

@mstaal
Copy link
Owner

mstaal commented Jan 6, 2025

Hi @arnabneogi86 ! Thanks for reaching out - I hope to be able to look at this asap. It looks as if you are working on a Windows environment. Have you tried managing the library using poetry as your package manager?

@robkerr
Copy link

robkerr commented Jan 9, 2025

For me in the given sample call, if the key is changed from an int to a string this error is resolved.
value = msal_authentication( auth={..}, cache={..}, login_request={..}, key="1")

@anoff
Copy link

anoff commented Jan 13, 2025

For me in the given sample call, if the key is changed from an int to a string this error is resolved. value = msal_authentication( auth={..}, cache={..}, login_request={..}, key="1")

Confirmed.

  • mcr.microsoft.com/devcontainers/python:3.10
  • streamlit==1.41.1
  • msal_streamlit_authentication==1.1.0

Deleting key completely also works. Thanks Robb!

numericOverflow added a commit to numericOverflow/msal_streamlit_authentication that referenced this issue Jan 24, 2025
Fixes mstaal#45 where example code uses a int for key, but Streamlit 1.41+ wants string for key.  This will now accept either int or string and keep examples working without having to change them everywhere.
@numericOverflow
Copy link

I just submitted a PR with my simple fix for this issue.

@numericOverflow
Copy link

BTW, @mstaal this component is awesome! I tried a number of other ways to make SSO work and hit roadblocks in everything else. This component is dead simple and I got the demo working in under 5 mins!

Now I just have to integrate it into my app

Thanks!

@numericOverflow numericOverflow linked a pull request Jan 24, 2025 that will close this issue
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.

5 participants