Securely deploy things that talk to external systems with keys, tokens, service accounts, or other auth mechanisms.
To fetch data from other tools and services, or to use services, it is quite common to need a secret of some sort (e.g an API key). You can add secrets to a Databutton app and securely deploy things that talk to external systems with keys, tokens, service accounts or other auth mechanisms.
Your data app secrets are encrypted in transit and at rest. They are also only available to those you have invited as collaborators to your specific data app.
Updating or adding a new secret can done through our UI by heading over to the configuration page for your data app. You can find that under the 'Configuration' button in the lower left corner.
To use a secret in your view or your app you can use
db.secrets.get('name'). For instance, if you have added a secret called
API_TOKEN, you can use it in a View or Job as follows:
import databutton as db
# Reading the data app secrets named 'API_TOKEN'
API_TOKEN = db.secrets.get("API_TOKEN")