diff --git a/README.md b/README.md index ac5a864..05fbe3e 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,4 @@ - [x] Write ESP8266 client - [ ] Make port configurable - [ ] Transfer using JSON -- [ ] Correctly implement basic auth +- [x] Correctly implement basic auth diff --git a/main.go b/main.go index 54bc201..0baae7d 100644 --- a/main.go +++ b/main.go @@ -148,6 +148,7 @@ func main() { http.HandleFunc("/departures", func(w http.ResponseWriter, r *http.Request) { user, pass, ok := r.BasicAuth() if !(ok && user == "admin" && pass == password) { + w.Header().Set("WWW-Authenticate", "Basic realm=\"Access to departure API\"") http.Error(w, "You shall not pass", http.StatusUnauthorized) return }