Unable to deploy a Streamlit app using st.login() to Digital Ocean

I am looking to deploy my Streamlit app to Digital Ocean… but there’s a problem.

My app uses st.login() which gets my Auth0 login credentials from the secrets.toml stored variables. However, there’s no place for me to pload my secrets file securely in Digital Ocean.

I can’t assign the credentials to environmental variables because Streamlit’s st.login() looks specifically for a secrets.toml file.

I don’t want to hard code my secrets in a secrets.toml file when I deploy my app, so what should I do to get st.login() to work on the deployed app?

I don’t have a Digital Ocean account to try this out and confirm if it works, but can you use Kubernetes style secrets with Digital Ocean?

I don’t think so, DigitalOcean App Platform (where I want to deploy it) only supports adding secrets as encrypted environment variables. Is there a way where I can just define the st.login() credentials in my python code as Digital Ocean Environmental Variables instead of needing to use the secrets.toml file?

I was looking at this:

Alternatively, someone suggested a workaround in a GitHub issue thread. Since it uses internal Streamlit methods, I can’t offer any guarantee on which versions of Streamlit would support it or if it would satisfy best security practices, though:

1 Like

The GitHub comment proposes a good workaround, thank you very much for linking me to it!

Hopefully Streamlit will be updated to accept environmental variables for the st.login() function natively (instead of requiring a secrets.toml file no matter what) in the near future.

1 Like