Type object 'Hasher' has no attribute 'passwords'

Hi guys.

I’m trying to make authenticating for my streamlit app. Everything works fine for local my local machine and i’ve deployed my app to Streamlit Cloud. Here starts difficulties.

I don’t want to store some info like credentials and user settings at config.yaml and decided to store it at private Google Sheet.

Now i cant figure out how do i store hashed passwords in private Google Sheet. I’ve tried to hash passwords with stauth.Hasher(passwords).hash_list() and it says AttributeError: type object ‘Hasher’ has no attribute ‘passwords’. I figured to hash one password with stauth.Hasher(passwords).hash(“mypass”) but it seems to weird.

So my questions is:

  1. What’s wrong with Hasher? Or am i doing smth wrong?
  2. Can i use secrets to store user info like credentials and settings? If yes, how do i? Where can find documentation about it?

It looks like that hash_list() function was broken in a recent release hash_list function is broken · Issue #230 · mkhorasani/Streamlit-Authenticator · GitHub, so it looks like you can either wait for the next release with a fix, or try an older version of the package.

Yes, you can use secrets to store use info like this – you can read more about it here Secrets management - Streamlit Docs

Thx for fast reply!

I’ve tried this code

import streamlit as st

Everything is accessible via the st.secrets dict:

st.write(“DB username:”, st.secrets[“db_username”])
st.write(“DB password:”, st.secrets[“db_password”])

st.write(st.secrets.my_other_secrets.things_i_like)

st.secrets.my_other_secrets.things_i_like.append(“streamlit?”)

st.write(st.secrets.my_other_secrets.things_i_like)

and now i’m suppose that st.secrets is temporary dictionary objectm because this

start
image
first refresh


second refresh

and this is not what i need. I wan’t to store user credentials for constant not just for session.

Can i write data to st.secrets section for constant? So that i’ll see it in secrets.toml localy, or in secrets section at Comunity Cloud?

Any hints to achieve my goals if it’s not possible?

hash_list() - rip :'O

The recommendation for using st.secrets is Secrets management - Streamlit Docs – please take a look at that. While you technically can write to st.secrets, the recommended way to use it is to put the secret values in .streamlit/secrets.toml (or for a deployed app, configure your app and paste them in there in toml format), and then just read them with st.secrets in your app.

Tyvm, now all is clear for me. :slight_smile:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.