From ea1e4108cc4bfc51b558994882354e6b8e286f99 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 9 Dec 2014 00:34:36 -0800 Subject: [PATCH] Auth header for API is now prefixed with X- to follow spec --- README.md | 2 +- homeassistant/components/http/frontend.py | 2 +- homeassistant/components/http/www_static/frontend.html | 2 +- .../http/www_static/polymer/home-assistant-api.html | 6 +----- homeassistant/const.py | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 01e1e1599f9..fc9328d53cd 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ Home Assistent runs a webserver accessible on port 8123. In the package `homeassistant.remote` a Python API on top of the HTTP API can be found. -The API accepts and returns only JSON encoded objects. All API calls have to be accompanied by the header "HA-Access" with as value the api password (as specified in `home-assistant.conf`). +The API accepts and returns only JSON encoded objects. All API calls have to be accompanied by the header "X-HA-Access" with as value the api password (as specified in `home-assistant.conf`). Successful calls will return status code 200 or 201. Other status codes that can return are: - 400 (Bad Request) diff --git a/homeassistant/components/http/frontend.py b/homeassistant/components/http/frontend.py index ed7199d1a93..5190b87f741 100644 --- a/homeassistant/components/http/frontend.py +++ b/homeassistant/components/http/frontend.py @@ -1,2 +1,2 @@ """ DO NOT MODIFY. Auto-generated by build_frontend script """ -VERSION = "f0d938f2a01a613e9fa0beb44940713d" +VERSION = "b32f2de4e3336946fe68cd1e5cd0fe6f" diff --git a/homeassistant/components/http/www_static/frontend.html b/homeassistant/components/http/www_static/frontend.html index d9e0e9f0e81..a49e7c83367 100644 --- a/homeassistant/components/http/www_static/frontend.html +++ b/homeassistant/components/http/www_static/frontend.html @@ -66,6 +66,6 @@ if(this.removeAttribute(a),d)return j(this,a,c);var e=c,f=m(this,a,e);return j(t + diff --git a/homeassistant/components/http/www_static/polymer/home-assistant-api.html b/homeassistant/components/http/www_static/polymer/home-assistant-api.html index 1c7795b0249..a5b398338ef 100644 --- a/homeassistant/components/http/www_static/polymer/home-assistant-api.html +++ b/homeassistant/components/http/www_static/polymer/home-assistant-api.html @@ -69,10 +69,6 @@ events: [], stateUpdateTimeout: null, - computed: { - ha_headers: '{"HA-access": auth}' - }, - created: function() { this.api = this; @@ -285,7 +281,7 @@ call_api: function(method, path, parameters, onSuccess, onError) { var req = new XMLHttpRequest(); req.open(method, "/api/" + path, true) - req.setRequestHeader("HA-access", this.auth); + req.setRequestHeader("X-HA-access", this.auth); req.onreadystatechange = function() { diff --git a/homeassistant/const.py b/homeassistant/const.py index 8930ae5649c..0dc4e7881e5 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -66,7 +66,7 @@ SERVICE_MEDIA_PREV_TRACK = "media_prev_track" # #### API / REMOTE #### SERVER_PORT = 8123 -AUTH_HEADER = "HA-access" +AUTH_HEADER = "X-HA-access" URL_API = "/api/" URL_API_STATES = "/api/states"