Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use HASSIO_TOKEN to authenticate with Websocket API #31668

Closed
qJake opened this issue Feb 9, 2020 · 2 comments
Closed

Can't use HASSIO_TOKEN to authenticate with Websocket API #31668

qJake opened this issue Feb 9, 2020 · 2 comments

Comments

@qJake
Copy link

qJake commented Feb 9, 2020

The problem

When authenticating to the websocket API via Javascript, providing a token obtained via the HASSIO_TOKEN environment variable (via an add-on) returns the error: Invalid access token or password.

image

Environment

Home Assistant 0.103.5 and 0.105.2
Hass.io (HassOS v3.9)
Websocket API Documentation

Problem-relevant configuration.yaml

You just need frontend: which enables the default websocket API.

Traceback/Error logs

Log of Websocket communication:

{"type": "auth_required", "ha_version": "0.105.2"}

{"type":"auth","access_token":"6c941fe7.....................eccd711837117"}

{"type": "auth_invalid", "message": "Invalid access token or password"}

image

Additional information

The documentation here should be clearer in terms of what types of tokens can be used and what can't, if this is not supported.

If this is not a supported scenario, how is an addon running in Hass.io supposed to authenticate to the Websocket API if it only has its token from the HASSIO_TOKEN env variable?

@probot-home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this issue as its been labeled with a integration (websocket_api) you are listed as a codeowner for? Thanks!

@frenck
Copy link
Member

frenck commented Feb 9, 2020

You have to use the API endpoint from the Supervisor and not talk directly to the Core. The API token is valid for the Supervisor, available on:

http://supervisor/core/api && http://supervisor/core/websocket.

(So it is valid for use internally, not externally)

PS: HASSIO_TOKEN has been renamed to SUPERVISOR_TOKEN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants