I'm Nathan. I'm a Web Developer. Check me out at nathanorick.com.
cnorick / ha-auto-guest-login Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://nathanorick.com/ha-automatic-guest-login
License: MIT License
Home Page: https://nathanorick.com/ha-automatic-guest-login
License: MIT License
I'm Nathan. I'm a Web Developer. Check me out at nathanorick.com.
Add an optional configuration entry that allows to set the home assistant URL instead of extracting it from the admin request.
The background can be found in issue #20.
Hi , i am a new home assistant user and I have integrated a guest dashboard (made with https://github.com/resoai/TileBoard) in the "www" folder, and it is accessed with "http://HASS_IP:8123/local/tileboard/index.html". My question is: Is there any way to redirect the guest to that dashboard or is it only compatible with lovelace?
(Pd: thanks for your dedication c: )
Chrome console:
GET http://ha.1156rbr.ca:8675/api/getRedirectUri net::ERR_CONNECTION_REFUSED
(anonymous) @ (index):50
Uncaught (in promise) TypeError: Failed to fetch
(anonymous) @ (index):50
Promise.then (async)
(anonymous) @ (index):52
GET http://ha.1156rbr.ca:8675/favicon.ico net::ERR_CONNECTION_REFUSED
:8675/favicon.ico:1
Safari:
[Error] Unhandled Promise Rejection: Not implemented on this platform
[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'i.generateKey')
promiseEmptyOnRejected (content-script.js:75:780)
promiseReactionJob
[Error] Failed to load resource: Could not connect to the server. (getRedirectUri, line 0)
[Error] Unhandled Promise Rejection: TypeError: Load failed
promiseEmptyOnRejected
promiseReactionJob
let me know if you need any other information
Hi,
First - many thanks for publishing this addon! Certainly makes life easier getting guests to use my install.
Unfortunately, I'm running into an interesting issue when attempting to connect via Cloudflare tunnel. Hope you can help!
Configuration:
guest_username: guest
guest_password: guest-password
guest_dashboard_path: dashboard-test
welcome_screen_delay_ms: 3000
welcome_screen_main_text: Thanks for Visiting
welcome_screen_secondary_text: Redirecting to Home Assistant...
advanced_internal_base_ha_url_and_port: http://my-homeassistant.local:8123
advanced_redirect_base_ha_url_and_port: https://my-hass.redacted.url:443
https://my-hass.redacted.url
is the external URL which maps through to the internal http://my-homeassistant.local:8123
http://my-homeassistant.local:8123
is the correct internal URL,
https://my-guest.redacted.url
is the external URL which is mapped through to http://my-homeassistant.local:8675
https://my-guest.redacted.url
we see the initial welcome page & are then redirected (as per log below)Uncaught (in promise)
exceptionPromise.then (async)
(anonymous) @ core.ts (112)
(anonymous) @ core-iXwZTYzGWuY.js
Addon log:
posted ha_auto_login_guest_logged_in event
recieved request from: http://my-guest.redacted.url
using internal url: http://my-homeassistant.local:8123
using redirect baseUrl: https://my-hass.redacted.url:443
using clientId: https://my-hass.redacted.url:443/
fetching flowId
url: http://my-homeassistant.local:8123/auth/login_flow
redirectUri: https://my-hass.redacted.url:443?auth_callback=1
flowId: f60b8cba717d3c9a4b737b4c9f64b724
fetching code
url: http://my-homeassistant.local:8123/auth/login_flow/f60b8cba717d3c9a4b737b4c9f64b724
code: 54d5ae8d99c9461783cd25c150be6cce
sending redirect uri to client
redirectUri: https://my-hass.redacted.url:443/dashboard-test?auth_callback=1&code=54d5ae8d99c9461783cd25c150be6cce&state=eyJoYXNzVXJsIjoiaHR0cHM6Ly9jYnItaGFzcy5ib3JnLWN1LmJlOjQ0MyIsImNsaWVudElkIjoiaHR0cHM6Ly9jYnItaGFzcy5ib3JnLWN1LmJlOjQ0My8ifQ%3D%3D&storeToken=true
Any hints as to where I might be going wrong?
Thanks!!
In the package.json file there is a comma that throws an error on my Debian 11 host when running npm install
{
"name": "homeassistant_login",
"version": "1.0.0",
"description": "",
"main": "server.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1", <<<< This last comma has to be removed to get it to run properly
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.2",
"node-fetch": "^3.1.0"
}
}
When running the docker compose all is fine, when starting the container too.
When I go to the correct URL I see the redirecting screen but nothing happens. When I check the log afterwards it gives me this error
SyntaxError: Unexpected token : in JSON at position 3
at JSON.parse (<anonymous>)
at Response.json (file:///app/node_modules/node-fetch/src/body.js:147:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async getFlowId (file:///app/server.js:31:11)
at async getCode (file:///app/server.js:35:18)
at async getRedirectUri (file:///app/server.js:61:14)
at async file:///app/server.js:73:12
Example app listening at http://localhost:80
Config:
version: "3"
services:
ha-auto-guest-login:
image: norick/ha-auto-guest-login:main
container_name: ha-auto-guest-login
environment:
- CLIENTID=http://192.168.2.160:8123/
- URL=http://192.168.2.160:8123/
- DASH=lovelace-guest/lights (have also tried without the '/lights')
- USER=guest-user
- PASS=(password contains lowercase, uppercase, numbers and punctuation marks, might that be a problem?)
ports:
- 80:80
restart: unless-stopped
Works perfectly in local network.
Is it possible somehow to configure Nabu Casa URL so HA is available from outside of local network?
Hello,
It's amazing how it work well!!
Do you ting it can be possible to add more users?
Thanks in advance
Hi,
I am trying to make it work with docker but I keep getting following error
exec /usr/local/bin/docker-entrypoint.sh: exec format error
Trying to install via Portainer on the same RPi4 that runs HA (via Portainer stack), I'm getting
exec /usr/local/bin/docker-entrypoint.sh: exec format error
This is my docker compose file:
---
version: "3"
services:
ha-auto-guest-login:
image: norick/ha-auto-guest-login:main
container_name: ha-auto-guest-login
environment:
- CLIENTID=http://192.168.0.181:8123/
- URL=http://192.168.0.181:8123/
- DASH=lovelace-mushroom
- USER=host
- PASS=aaaa
ports:
- 4077:80
restart: unless-stopped
I tried to install the plain, dockerless version on a different RPi3 only to get this:
/home/pi/ha-auto-guest-login/server.js:1
import fetch from "node-fetch"
^^^^^
SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Please help.
I think I figured out how to created a docker image, and this will be my first PR, so apologies if its clunky.
For the environment variable documentation I recommend removing the trailing "/" after .local. It seems to cause issues.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.