Noob needing help with REST setup

Hi, I’m a Noob with REST etc, but hoping someone can help point me in the right direction as I’m struggling to get anywhere! I have read the HA Rest docs but am still rather lost.

I have a Python package (written by someone else) which launches a local server using docker. The Py package communicates with an external API to control my heat pump. By putting the following URL into a browser, it returns a secret in the format “FF6OZELCIZNADCEDZTIF”.

http://192.168.0.9:5000/token?user=xxxxx&password=xxxxx

If I then copy and use that secret to append other URLs I can control or get device information from my system as required.

Ideally I would like to work out a way to check that the response from the following URL is “ok”, but if it returns “auth error” then to go back to the first URL to generate a fresh secret from my user/pass:

http://localhost:5000/update?secret=FF6OZELCIZNADCEDZTIF

The problem I am having is working out how to implement this in HA. I have managed to get it to work with a simple shell_command, for example:

shell_command:
  set_target_flow_temperature: curl http://192.168.0.4:5000/zone/set_target_heat_flow_temperature/{{ states('input_number.heat_pump_set_target_flow_temperature') }}?secret={{ states('input_text.heat_pump_set_secret') }} 

I have tried playing around with the Rest platform as below, but am struggling to get passed “auth error”. I am aware that ideally I would have the secret in secrets.yaml but wanted to start simply first:

- platform: rest
  name: Heat Pump Update Local Data
  unique_id: control_update
  scan_interval: 120
  resource: http://192.168.0.9:5000/device
  headers:
    Authorization: Token UIYDP5P94832ZDF2ZNMM  
  method: GET
  value_template: >-
    {{ value }}

Go easy on me, but I’d really appreciate some pointers
Thanks