diff --git a/README.md b/README.md
index 021b6d1..45b47d2 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,6 @@
 
 - [x] Use timeout for fetching departures
 - [ ] Write ESP8266 client
-- [ ] Add basic auth
+- [x] Add basic auth
 - [ ] Create Nix package
 - [ ] Create container
diff --git a/main.go b/main.go
index edb887c..6fe9c4f 100644
--- a/main.go
+++ b/main.go
@@ -5,6 +5,7 @@ import "fmt"
 import "log"
 import "net/http"
 import "net/url"
+import "os"
 import "slices"
 import "strconv"
 import "time"
@@ -81,7 +82,18 @@ func FetchDepartures(stopId string) (*DMResponse, error) {
 }
 
 func main() {
+	password := os.Getenv("VRNP_PASSWORD")
+	if len(password) == 0 {
+		panic("Required environment variable VRNP_PASSWORD is not set");
+	}
+
 	http.HandleFunc("/departures", func(w http.ResponseWriter, r *http.Request) {
+		user, pass, ok := r.BasicAuth()
+		if !(ok && user == "admin" && pass == password) {
+			http.Error(w, "You shall not pass", http.StatusUnauthorized)
+			return
+		}
+
 		query := r.URL.Query()
 
 		if query["stop_id"] == nil || len(query["stop_id"]) < 1 {