Where to place Mapbox token?

When deploying to Streamlit Cloud, do I put the Mapbox token in the app’s secrets? Or, is there some other place for app configs?

Hi @kinghuang, :wave:

You should add your Mapbox token to the Streamlit .streamlit/config.toml configuration file in your repo:


# Configure Streamlit to use a custom Mapbox token for elements like st.deck_gl_chart and st.map. To get a token for yourself, create an account at https://mapbox.com. It's free (for moderate usage levels)!
# Default: ""
token = ""

Please see this knowledge base article and forum thread for more information.

Happy Streamlit-ing! :balloon:

Checking the key into the repository would leak it to anyone that cares to look. Is there not a more secure way to do this for Streamlit Cloud apps?

1 Like

That’s a really good point @kinghuang, let me consult our engineering team about this. I hope this isn’t something we neglected to consider :grimacing:


1 Like