Streamlit Secrets in the the app

Python 3.10
Streamlit 1.20

Just wondering if I could get some help from the community here.

I’m trying to deploy a Streamlit app in the community cloud.

Q1) How do I call credentials list from app.py?
Q2) How do I put credentials list in Secrets.toml?

I do know that I’ll need to add that info list in secrets.toml, and I want to do this after deployment.
And this is where my issue is as Secrets said “Invalid format”.

  • Below is the snippet of the code that will be in the app which will be uploaded to Github.

def main_log_cre():

  valid_credentials = [
  {'user': 'us1', 'pin': 'pin123'},
  {'user': 'us2', 'pin': 'pin456'},
  ]

main_log_cre()

I’ll have a loop code here after the list that will look for
user input and pin in valid_credentials list which I want to keep in secrets.toml in
the App setting, Secrets

Many thanks

Hi @horasio

It seems this may be doable if self deploying the app, however deploying to the Community Cloud requires the credentials to be explicitly defined directly on the Community Cloud platform in the App Settings.

A side note, credentials should not be uploaded to GitHub for security purposes.

Hope this helps!

I also thought so. And thank you for confirming that. I shall try and see if I can deploy it from other places.

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