Load secret from Vault only once when initializing #17039
-
I'm using https://github.com/auth0/nextjs-auth0/ but I don't think it matters too much. I'm trying to fetch a secret from Vault using async/await but I get a What is the proper way to do this? // utils/auth0.js
async function getSecretFromVault() {
const res = await client.fetchSecret();
console.log(res); // shows my secret correctly
return res;
}
const secret = getSecretFromVault();
console.log(secret); // shows Promise { <pending> }
export default initAuth0({
clientId: "my_ID",
clientSecret: secret // this will be invalid: UI shows "client_id is required"
....
}); Would a plugin help doing that maybe? The problem is similar (or even worse) if I try to do this in Also asked here auth0/nextjs-auth0#167 and here https://stackoverflow.com/questions/63868754/fetch-secret-from-vault-when-initializing-next-js. Any really help very appreciated, cheers |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Someone posted a solution that works on SO https://stackoverflow.com/a/63874771/1515819 |
Beta Was this translation helpful? Give feedback.
Someone posted a solution that works on SO https://stackoverflow.com/a/63874771/1515819