I tried to read the Azure Key Vault in React App using DefaultAzureCredentials, but is not working.
Tried every other way but no luck.I heard we cannot read KV Secrets in Client Side. Can anyone help on how to read this secrets.
I tried to Get the secrets from KV using
I tried the frontend with React JS and backend with JavaScript to retrieve Azure Key Vault secret using DefaultCredentials.
Code :
backend/server.js :
package.json :
frontend :
src/components/SecretReader.js :
src/App.js :
I provided access to my app, allowing it to retrieve the secret from the Azure Key Vault, as shown below:
Output :
The backend code started running on port 3000 as shown below.
I retrieved the secret from the Azure Key Vault as shown below.
Then, I started my frontend React.js code on port 3001 as shown below.
I successfully retrieved the secret from the Azure Key Vault as shown below.