diff --git a/captiveportal-autologin/login-captive-portal.service b/captiveportal-autologin/login-captive-portal.service
new file mode 100644
index 0000000..99c804d
--- /dev/null
+++ b/captiveportal-autologin/login-captive-portal.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Autologin to captive portal
+
+[Service]
+Type=oneshot
+
+# Only run when connected to wifiSSID which "nmcli | grep wifiSSID" will return 0
+ExecCondition=sh -c "nmcli | grep wifiSSID"
+ExecStart=/var/home/user/.local/bin/login-captive-portal.sh
+
+
+[Install]
+WantedBy=multi-user.target default.target
diff --git a/captiveportal-autologin/login-captive-portal.sh b/captiveportal-autologin/login-captive-portal.sh
new file mode 100755
index 0000000..442d317
--- /dev/null
+++ b/captiveportal-autologin/login-captive-portal.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+USERNAME=
+PASSWORD=
+
+URL="captive-portal-url"
+
+# Use browser devtools to see what is being sent when the login button is pressed when logging in via web browser
+PAYLOAD="Login=${USERNAME}&Passwd=${PASSWORD}&chkRemember=1&btnLogin=Login&reqUrl=http%3A%2F%2Fwww.google.co.th&reqCheck=false"
+
+# Spoof a normal-looking user agent
+USER_AGENT="User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
+
+curl -X POST "$URL" -d "$PAYLOAD" -H "$USER_AGENT"
+
diff --git a/captiveportal-autologin/login-captive-portal.timer b/captiveportal-autologin/login-captive-portal.timer
new file mode 100644
index 0000000..465cb05
--- /dev/null
+++ b/captiveportal-autologin/login-captive-portal.timer
@@ -0,0 +1,8 @@
+[Unit]
+Description=Connect to captive portal
+
+[Timer]
+OnCalendar=hourly
+
+[Install]
+WantedBy=default.target