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

Hass.io sent token to supervisor #15536

Merged
merged 2 commits into from Jul 23, 2018
Merged

Hass.io sent token to supervisor #15536

merged 2 commits into from Jul 23, 2018

Conversation

balloob
Copy link
Member

@balloob balloob commented Jul 18, 2018

Description:

Have the Hass.io component create a system user and share a refresh token with the supervisor on startup. It will only generate it once and sent the same refresh token on each start.

The supervisor can use this token to fetch an access token to allow add-ons to access the Home Assistant API. In the future we might extend this to be a system account per add-on that wants access.

If the auth system is not active, the refresh token value is set to null.

Blocked by release of home-assistant/supervisor#575

CC @pvizeli

Related issue (if applicable): fixes #15220

Example entry for configuration.yaml (if applicable):

hassio:

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

aioclient_mock.get(
"http://127.0.0.1/homeassistant/info", json={
'result': 'ok', 'data': {'last_version': '10.0'}})

@asyncio.coroutine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

@asyncio.coroutine
def test_setup_api_ping(hass, aioclient_mock):
"""Test setup with API ping."""
@pytest.fixture(autouse=True)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

@balloob balloob added this to the 0.74 milestone Jul 18, 2018
else:
token = None

yield from hassio.update_hass_api(config.get('http', {}), token)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want migrate it to await?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a different PR.

@balloob
Copy link
Member Author

balloob commented Jul 18, 2018

@pvizeli for supervisor support, it looks like the supervisor won't allow unused options to be sent in. I think that we should change that so that it's easier to develop new features.

I would like this change to go out on Friday, however right now it will break sending data to the supervisor. Would you be fine with adding an extra=vol.ALLOW_EXTRA to the schema and push that as an update to supervisors?

@balloob balloob changed the title Hass.io sent token to supervisor WIP: Hass.io sent token to supervisor Jul 19, 2018
@balloob balloob removed this from the 0.74 milestone Jul 19, 2018
@balloob balloob changed the title WIP: Hass.io sent token to supervisor Hass.io sent token to supervisor Jul 23, 2018
@balloob balloob merged commit 8213b14 into dev Jul 23, 2018
@ghost ghost removed the in progress label Jul 23, 2018
@balloob balloob deleted the hassio-token branch July 23, 2018 12:15
michaeldavie pushed a commit to michaeldavie/home-assistant that referenced this pull request Jul 31, 2018
@balloob balloob mentioned this pull request Aug 3, 2018
@thecodingcheese
Copy link

thecodingcheese commented Aug 4, 2018

This commit why hass.io tab gets a blank white page now?

@frenck
Copy link
Member

frenck commented Aug 4, 2018

@thecodingcheese Please do not use PR's to raise issues.
The issue is being tacked here: #15816

@home-assistant home-assistant locked as off-topic and limited conversation to collaborators Aug 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auth + Hass.io: create system user
6 participants