Add ha-authenticate-with-token.sh

This commit is contained in:
2025-12-31 04:26:44 -08:00
parent 672ebe32fb
commit c1dbc1e0da

View File

@@ -0,0 +1,24 @@
#!/bin/bash
# Authenticate to Home Assistant using the long-lived token
# This creates a session that can be used for web UI access
HA_URL="http://homeassistant.local:8123"
TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJlOWM3YmRjMmY2ZTM0ZTliOTAzMjg2M2NlYWNjODM5ZSIsImlhdCI6MTc2NjkxNjk0MiwiZXhwIjoyMDgyMjc2OTQyfQ.r02yFKwxGKWr07Pil7Bp3IHhjJXrSBOhkdOGh5VzKk4"
echo "Attempting to authenticate with token..."
# Try to use the token to create a web session
# Home Assistant might accept the token as a cookie or header
# Actually, for web UI, we need to use trusted networks or saved session
# But let's try using the token in a different way - via a bookmarklet or
# by setting it as a cookie
echo "For web UI auto-login, you have two options:"
echo ""
echo "1. TRUSTED NETWORKS (Recommended - no keyboard needed)"
echo " - Add IP 192.168.68.193 to Home Assistant trusted networks"
echo " - See: ~/scripts/setup-trusted-networks-instructions.txt"
echo ""
echo "2. Use the token to create an authenticated session via API"
echo " This requires some setup but might work..."