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

Allow token authentication for Hook switch component #6922

Merged
merged 1 commit into from
Apr 4, 2017

Conversation

KlaasH
Copy link
Contributor

@KlaasH KlaasH commented Apr 4, 2017

Description:

The Hook switch component currently uses username/password to get a token from the Hook web app to use for subsequent requests. This PR adds an option to specify the token directly in config.

Makes the 'password' and 'token' options mutually exclusive since otherwise one would have to take precedence, and it seems worth preventing people from filling their config with passwords that don't
even need to be there.

Pull request in home-assistant.github.io with documentation: home-assistant/home-assistant.io#2378

Example entry for configuration.yaml:

# Example configuration.yaml entry
-  platform: hook
   token: <your API token>

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • [na] New dependencies have been added to the REQUIREMENTS variable (example).
  • [na] New dependencies are only imported inside functions that use them (example).
  • [na] New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • [na] New files were added to .coveragerc.

The Hook switch component currently uses username/password to get a token
from the Hook web app to use for subsequent requests. This adds an option
to specify the token directly in config.

Makes the 'password' and 'token' options mutually exclusive since
otherwise one would have to take precedence, and it seems worth
preventing people from filling their config with passwords that don't
even need to be there.
@mention-bot
Copy link

@KlaasH, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fabaff, @dasos and @balloob to be potential reviewers.

@homeassistant
Copy link
Contributor

Hi @KlaasH,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@pvizeli pvizeli merged commit 57a00c1 into home-assistant:dev Apr 4, 2017
@dasos
Copy link
Contributor

dasos commented Apr 4, 2017

Well, I'm very happy that someone else is using Hook and Home Assistant! 👍

Just a thought though - might the token not expire after some time?

@KlaasH
Copy link
Contributor Author

KlaasH commented Apr 5, 2017

@dasos Thanks for writing this! I had been using command_line switches. This is way more convenient.

There's a manual "Reset Token" menu item on the web app, but I would assume they don't reset them otherwise. I guess I'll find out...

@fabaff fabaff mentioned this pull request Apr 6, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Jul 17, 2017
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.

6 participants