Securely store and use a secret
Problem
You need to store a secret and access it securely without exposing it in the editor.
Solution
- Browse to the Configuration tab in the Dynaboard editor
- In the App Secrets panel, click the + button
- Name your secret (e.g. MY_API_KEY) and enter the secret into the value field below
- Your secret is now accessible in server-side resources using ${{ MY_API_KEY }}
Discussion
- Dynaboard stores your secret securely at rest using industry-standard practices with auditable access. However, your secrets are accessible to other developers on your app.
- Secrets can be accessed on any server-side resource, including REST API Resource headers. For example, to use your new secret as the Bearer Authorization header of HTTP requests for a resource:
- Create the REST API Resource
- Find the Default Headers panel and click the + button
- Give your header a name of Authorization
- Give your header a value of Bearer ${{ MY_API_KEY }}
 
- Secrets may also be used in TypeScript Server functions:
const myAPIKey = ${{ MY_API_KEY }}
const res = await fetch('https://httpbin.org/post', {
	method: 'POST',
  headers: {
		Authorization: 'Bearer ' + myAPIKey,
  }
})
 
const resBody = await res.json()
return resBody- Secrets cannot be accessed from client-side code. For example, you cannot access secrets from the {{ bindings }}in UI components or in TypeScript Client functions.