API Ecowatt a través de Node-Red a Gladys

Me gustaría integrar la nueva API Ecowatt (Catalogue API - API Data RTE) en Gladys.
Esta API es accesible mediante un token bearer efímero que hay que renovar cada 2 horas.

A través de Node-red se puede recuperar el token mediante una solicitud http, luego reinyectar manualmente este token en una nueva solicitud http para obtener el payload de la API.
Esta solución funciona bien, pero no es muy práctica.

Por lo tanto, he buscado (sin éxito) una solución para automatizar esta segunda solicitud inyectando una variable que corresponda al token actualizado cada 2 horas.
Creo que hay que pasar por una función, pero no logro proporcionar los buenos headers de la solicitud.

Si un especialista de Node-red tiene la solución, estoy interesado.
Gracias de antemano.
jparbel

Es una autenticación OAuth2, hay librerías para gestionar este protocolo.

EDIT: Acabo de probarlo con éxito

Un flujo de ejemplo

[
    {
        "id": "eee1757110226f86",
        "type": "tab",
        "label": "Ecowatts -> Gladys",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "27ed541908cb256d",
        "type": "oauth2",
        "z": "eee1757110226f86",
        "name": "",
        "container": "oauth2Response",
        "grant_type": "client_credentials",
        "access_token_url": "https://digital.iservices.rte-france.com/token/oauth/",
        "authorization_endpoint": "",
        "redirect_uri": "/oauth2/redirect_uri",
        "open_authentication": "",
        "username": "",
        "password": "",
        "client_id": "XXXXXXXXXXXXXXXXXXX",
        "client_secret": "XXXXXXXXXXXXXXXX",
        "scope": "",
        "rejectUnauthorized": true,
        "headers": {},
        "x": 250,
        "y": 60,
        "wires": [
            [
                "e54c33cdc4a66e73"
            ]
        ]
    },
    {
        "id": "5c8888796344fe7e",
        "type": "debug",
        "z": "eee1757110226f86",
        "name": "debug 2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 680,
        "y": 60,
        "wires": []
    },
    {
        "id": "4141ecf227805b07",
        "type": "inject",
        "z": "eee1757110226f86",
        "name": "Get",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 110,
        "y": 60,
        "wires": [
            [
                "27ed541908cb256d"
            ]
        ]
    },
    {
        "id": "d1cc9455efc67f83",
        "type": "http request",
        "z": "eee1757110226f86",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "https://digital.iservices.rte-france.com/open_api/ecowatt/v4/signals",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 530,
        "y": 60,
        "wires": [
            [
                "5c8888796344fe7e"
            ]
        ]
    },
    {
        "id": "e54c33cdc4a66e73",
        "type": "function",
        "z": "eee1757110226f86",
        "name": "function 1",
        "func": "msg.headers = {\n    Authorization: \"Bearer \"+msg.oauth2Response.access_token\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 380,
        "y": 60,
        "wires": [
            [
                "d1cc9455efc67f83"
            ]
        ]
    }
]

@VonOx, gracias Vincent, funciona super bien, ¡no es complicado cuando se sabe hacer! !