Dynamic Authorization header for REST sensor

I’m sorry. I forgot the script is run by the own HA in automations.yml:

 - trigger: 
    platform: time
    at: "00:10:00"  
  action:
    - service: shell_command.refresh_token
    - delay: '00:01'
    - service: homeassistant.restart