RESTful header for access token

Hi everyone,

I’ve been trying to add a RESTful sensor to my home assistant, and have encountered a problem with the access token.

I got the sensor working by adding the access token to the end of URL (?access_token=MYACCESSTOKEN).

However, now I need to move the access token into RESTful headers. And when I try to do

headers:
access_token: MYACCESSTOKEN
the home assistant gives an error as “Access token is missing”.

I tried a few other ways such as

headers:
authentication: Bearer MYACCESSTOKEN
But still no luck.

Can someone please help me?

OK, I got it working.
Apparently, this is supposed to be authorization instead of authentication.

I have a problem accessing HA with the token.

I have it like this:

url:8123/api/services/script/turn_on?access_token=mytoken

But all I get is:

Login attempt or request with invalid authentication

Even tried restarting the HA but did not help. Any tips?