I try to use the "google-api-nodejs-client" (https://github.com/googleapis/google-api-nodejs-client) with a JSON Web Token in a flowground connector implementation. Is there a possibility to get the environment variable "GOOGLE_APPLICATION_CREDENTIALS" point to a configurable JWT file that the user can upload into a flow?

Example of client usage from the library page:

// This method looks for the GCLOUD_PROJECT and GOOGLE_APPLICATION_CREDENTIALS
// environment variables.
const auth = new google.auth.GoogleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-platform']
});
2

There are 2 best solutions below

1
On BEST ANSWER

Lets see if I understand correctly what you want to do:

  • create a flow that can be triggered from outside and accesses any Google API via google-api-nodejs-client module.
  • every time you trigger the flow you will post a valid JWT for accessing any Google API
  • you want to store the JWT in the local file-system; the mentioned environment variables contains the path to the persisted JWT.

Generally spoken this is a valid approach for the moment.
You can create a file in the local file-system:
fs.writeFile(process.env.HOME + '/jwt.token', ...)
Sebastian already explained how to define the needed environment variables.
Please keep in mind that writing and reading the JWT file must take place in the same step of flow execution. There is no persistence of this file after finishing execution of this step.

Why is this a valid approach for the moment only?
I assume that we will prevent writing in the local file-system in the near future. This will prevent the described solution as well.
From my point of view the better solution would be using the OAuth2 mechanism build in flowground.
For more information regarding this approach

0
On

You can set environment variables in flowground following on the "ENV vars" page for your connector:

enter image description here