Search code examples
google-cloud-platformnode-redbearer-tokengoogle-cloud-automl

Google Bearer auth on http request via Node-RED


I want to use the AutoML API via Node-RED and I have the request URL, but I have to create a bearer token from the service account .json somehow regularly, because the token expires in 3.600 seconds. Any clue how I can achieve this or any other idea how to call the AutoML API in a different way?

Any help is very, very much appreciated!


Solution

  • To do this you probably need 2 flows working together.

    The first uses an inject node to every hour (3600 seconds) that gets a new auth token. This token is stored in a context variable.

    You can then use this context variable to set the right headers on the http-request node to AutoML API