Hi,
Background:
We are building a Multi tenant node js application where user can come in with their credentials and use our app to interact with Google pub sub.
Few points to be noted:
Question:
Please suggest.
Thanks.
@nazimkh At a glance, you should be able to make separate PubSub objects and publish for different clients. I don't know the full stack offhand, so I'm not 100% sure of that, but it makes sense to me.
The way to get different authentication for each one is to pass in the credentials manually instead of letting the library pull it from environment variables. So you'd create one more or less like this:
const pubsub = new PubSub({
projectId: 'yourProject',
credentials: {
client_email: "[email protected]",
private_key: "-----BEGIN PRIVATE KEY-----\n etc",
},
});
You can find those client_email and private_key values from the downloaded JSON key that you get from the GCP web console. Instead of credentials you can also use keyFilename and pass a path to the JSON key.
If that works for you, go ahead and close the issue out, or let me know if you need further help.
@feywind it works properly. Thanks
Most helpful comment
@nazimkh At a glance, you should be able to make separate PubSub objects and publish for different clients. I don't know the full stack offhand, so I'm not 100% sure of that, but it makes sense to me.
The way to get different authentication for each one is to pass in the credentials manually instead of letting the library pull it from environment variables. So you'd create one more or less like this:
You can find those
client_emailandprivate_keyvalues from the downloaded JSON key that you get from the GCP web console. Instead ofcredentialsyou can also usekeyFilenameand pass a path to the JSON key.If that works for you, go ahead and close the issue out, or let me know if you need further help.