The Secrets Manager allows you to store and encrypt API keys and other secrets on your site. With the Secrets API, you can safely work with secrets in your backend code.
Follow this general procedure for working with API keys or other secrets using the Secrets Manager:
- Get private information such as an API key from a 3rd-party service.
- Store the private information as a new secret in the Secrets Manager in your site's dashboard or with the
createSecret()function. Assign a name to the secret.
- In your backend code, instead of hardcoding the API key, use the
getSecret()function with the secret name assigned in the Secrets Manager. When the code runs, the value of the secret is extracted from the Secrets Manager.
To use the Secrets API, import
wixSecretsBackend from the
Was this helpful?