azure-sdk-for-js: "Request is missing a Bearer or PoP token." with Client token
- Package Name: @azure/keyvault-secrets
- Package Version: “^4.1.0”
- Operating system: Windows 10
- nodejs
- version: 14.8.0
- browser
- name/version: Chrome/84.0.4147.135
- typescript
- version: “^3.9.6”
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug Access Azure Key Vault from Gatsby/React app Initiate access with
this.keyVaultUri = `https://${keyVaultName}.vault.azure.net`;
const credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
this.keyVaultClient = new SecretClient(this.keyVaultUri, credential);
Get a specific secret lke
get GoogleMapApiKey() {
return (async () => await this.keyVaultClient.getSecret('GoogleMapApiKey'));
}
Get the secret value like:
const mapsKey:KeyVaultSecret = await keyVault.GoogleMapApiKey();
setGoogleMapsApiKey(mapsKey.value ?? '' );
To Reproduce Steps to reproduce the behavior: Illustrated in the description
Expected behavior Should retrieve the secret from the Azure Key Vault.
Additional context This seems related to #9005. This is a Gatsby React app. I am using TypeScript.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 29 (16 by maintainers)
One more thought for which I have NO experience is to add Azure function to the app. Since it is already being deployed to static web site on Azure this seems like a natural place to put a function?
Again thank you for the help.
Kevin
On Wed, Aug 26, 2020 at 1:05 PM Daniel Rodríguez notifications@github.com wrote:
It would. If you have time. Thank you.
Kevin
On Wed, Aug 26, 2020 at 1:01 PM Daniel Rodríguez notifications@github.com wrote:
I am too new to Gatsby to understand how this all works but I will look into it. The big hurdle for me right now is the comment “and you could invoke that and await inside your plugin”, which indicates to me that I need to develop and use a plugin which right now I don’t know how to do.
On Wed, Aug 26, 2020 at 12:57 PM Daniel Rodríguez notifications@github.com wrote:
Oops I forgot to add in the secrets to the config.
siteMetadata: { title:
Great State Strength and Conditioning
, description:Great State web page
, author:@KevinBurton
, …keyVaultSecrets },Kevin
On Wed, Aug 26, 2020 at 12:15 PM Kevin Burton ronald.kevin.burton@gmail.com wrote:
By the way I am using node v14.8.0, I am not sure what needs to change to support this asynchronous feature?
On Wed, Aug 26, 2020 at 11:42 AM Kevin Burton ronald.kevin.burton@gmail.com wrote: