How can I access secrets (MATLAB vault) in web apps?
7 views (last 30 days)
Show older comments
MathWorks Support Team
on 22 Oct 2025 at 0:00
Answered: MathWorks Support Team
on 22 Oct 2025 at 16:09
I am deploying an app to MATLAB Web App Server that uses secrets. Currently, this works in my local MATLAB installation using setSecret and getSecret. How can I use these secrets when deploying this app as a web app on MATLAB Web App Server?
Accepted Answer
MathWorks Support Team
about 16 hours ago
There are a few options for this workflow.
Use MATLAB Web App Server's Secrets Vault (requires admin access)
As of R2024a, MATLAB Web App Server maintains its own server-side secrets vault. A server administrator can add, remove, and implement access control for secrets on supported releases. Refer to the following documentation for more information:
Use Environment Variables
Your web app can access secrets stored as environment variables either on your server machine or packaged with your app. Packaging environment variables with your app (as an .env file) and loading them at app startup can be a great option if you do not have access to the server machine. For more information, refer to the documentation:
Package Code with Secrets
As of R2024b, you can package MATLAB vault secrets with your web app using a secrets manifest JSON file. This file can be included during compilation by specifying the path as the SecretsManifest name-value argument with compiler.build.webAppArchive. Note that this may throw benign errors during execution, as calls to getSecret will check the server-side vault for the requested secret first. For more information, see:
0 Comments
More Answers (0)
See Also
Categories
Find more on MATLAB Web App Server in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!