Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 109124

Rest sensor getting header authentication key from sensor

$
0
0

Hi all, looking for a little help.

I’m passing a rest sensor header authentication key via the following sensor as the key changes every hour and is to large for the value field.

headers:
      accept: application/json
      authorization: "{{ states.sensor.bearer_token.attributes.bearer_attribute }}"

When I call this sensor It appears that a carriage return is being placed between Bearer and the key and causes authentication to fail. It looks something like this:

bearer_attribute: >-
Bearer
eyJpZHRva2VuIj12341239askdjf;laksdjl;kj234ljk;lkjzxdfl;kgj;lkasdjlk;j2345;kj…

It needs to be like this:

bearer_attribute: >-
Bearer eyJpZHRva2VuIj12341239askdjf;laksdjl;kj234lj…

Is there a way to prevent the carriage return form being inserted?
When I pass the following as text it works as expected.

authorization: Bearer eyJpZHRva2VuIj12341239askdjf;laksdjl;kj234lj.........

bearer attribute shown below.

      bearer_token:
        value_template: 'OK'
        attribute_templates:
          bearer_attribute: "Bearer {{ states.sensor.token.attributes.access_token }}"

Appreciate any help!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 109124

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>