I have secret key and secret resource ID I just have to access from ReactJs application
I did install @google-cloud/secret-manager package in ReactJs application but don't know what I have to follow next
I have secret key and secret resource ID I just have to access from ReactJs application
I did install @google-cloud/secret-manager package in ReactJs application but don't know what I have to follow next
I do not have enough information to answer your question in detail however, here is what I propose.
Create a backend/server-side REST API to communicate with your react app. Use the secret manager on the backend side of your application to do whatever processing needs to be done, after that communicate with your frontend with appropriate resources.
Now since you have npm
package I would assume that you will be good using Nodejs perhaps together with Expressjs, so now with those, you could use @google-cloud/secret-manager
like so:
// Imports the Secret Manager library
const {SecretManagerServiceClient} = require('@google-cloud/secret-manager');
// Instantiates a client
const client = new SecretManagerServiceClient();
async function getSecret() {
const [secret] = await client.getSecret({
name: name,
});
const policy = secret.replication.replication;
console.info(`Found secret ${secret.name} (${policy})`);
}
getSecret();