Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📚 Ingress and API authentification #70

Closed
MelleD opened this issue Jan 23, 2024 · 22 comments · Fixed by #74
Closed

📚 Ingress and API authentification #70

MelleD opened this issue Jan 23, 2024 · 22 comments · Fixed by #74
Labels
documentation Improvements or additions to documentation wontfix This will not be worked on
Milestone

Comments

@MelleD
Copy link

MelleD commented Jan 23, 2024

Hello,

do you use a third party app to upload, e.g. Paperparrot or Paperless Swift?
https://github.com/paperless-ngx/paperless-ngx/wiki/Affiliated-Projects

I tried to add a long living bearer token in HA and include it as a header in the request. But unfortunately I can't get through. Can I access the paperless UI without going to home assistant?

@BenoitAnastay
Copy link
Owner

Yes, you will have to go on the addon configuration tab then enable a port.

There is no way to disable Home Assistant auth for an ingress endpoint such as API, that why we need to enable direct access.

If I add the HA auth to Paperless through ingress i'll probably add a port that will only be usable for API

@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

@BenoitAnastay thanks let me try :)

@BenoitAnastay BenoitAnastay added documentation Improvements or additions to documentation wontfix This will not be worked on labels Jan 23, 2024
@BenoitAnastay BenoitAnastay added this to the Next release milestone Jan 23, 2024
@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

Nice works, but the sidebar ist now not working anymore.
"Ingress is disabled because you opended a port".

Is it possible to not adjust the URL for the sidebar? Maybe internal url + port or a properties to customize the url so that you can continue to use the sidebar?

Or maybe provide both e.g. EVCC provide the ingress and also the UI on port 7070. So you can use the sidebar and the UI directly with the port.
https://github.com/evcc-io/hassio-addon

@BenoitAnastay
Copy link
Owner

Have you updated the add-on to the last release?

@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

Ah lol. Sorry didn't see the last release.
But interesting, I only installed it yesterday, why didn't I get 1.1.3 straight away and I don't see an update either.

@BenoitAnastay
Copy link
Owner

My apologies, it wasn't pushed to the repository, I don't know why

@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

No problem. When it's available I'll test the new version :)

@BenoitAnastay
Copy link
Owner

It's updated, there was a weird bug on GitHub side 1.1.2 was stuck as last release even though 1.2.3 was tagged last 🤔🤷‍♂️

@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

Works thank you a lot

@MelleD MelleD closed this as completed Jan 23, 2024
@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

Bildschirmfoto 2024-01-23 um 18 25 22

Interesting one if i have no token and login directly. I get this error (maybe this is the issue why i get no connection from the mobile app).

If I use first the HA instance and login it works

@MelleD MelleD reopened this Jan 23, 2024
@BenoitAnastay
Copy link
Owner

It's #69 issue.

On network configuration https://my.home-assistant.io/redirect/network/

You can manually set internal URL to http://homeassistant.local:8123

Then restart home assistant, you may need to do the same for external_url it will also extract base host to set the direct access to the list of allowed URLs

@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

And if add as URL: http://homeassistant.local:7071/ then it's the other way around :).

@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

It's #69 issue.

Are you sure?
Maybe i have just to set this
https://docs.paperless-ngx.com/configuration/#PAPERLESS_CSRF_TRUSTED_ORIGINS
to http://homeassistant.local:8123/,http://homeassistant.local:7071

@BenoitAnastay
Copy link
Owner

BenoitAnastay commented Jan 23, 2024

There's a script integrated that will set this automatically using defined external url and internal url

# Get all possible URLs
result=$(bashio::api.supervisor GET /core/api/config true || true)
urls+=("$(bashio::info.hostname)")
urls+=("$(bashio::jq "$result" '.internal_url' | cut -d'/' -f3 | cut -d':' -f1)")
urls+=("$(bashio::jq "$result" '.external_url' | cut -d'/' -f3 | cut -d':' -f1)")

As you can see I forgot to append .local to the hostname (and yes it's hardcoded in Home Assistant)

@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

Iam not using the external url, because my instance is just locally available or with the internal url over VPN (tailscale)

so IMHO what is missing, is when a port is set the in the config also to add this url
e.g. internal url + defined port in my case http://homeassistant.local:7071

EDIT:
Ah it's here:
urls

The addon port is in my case the 7071, correct?

@BenoitAnastay
Copy link
Owner

The addon port is in my case the 7071, correct?

Yes it's taking the value form the one you put in your addon configuration

@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

Ok got it.
Then I think with the issue #69 there are two missing urls.
a) the url with .local and default port (8123)
b) the url with .local and add on port

As long as that isn't fixed, I'll try it myself. But now I can't log in at all. Now I'm confused :D
PAPERLESS_CSRF_TRUSTED_ORIGINS=http://homeassistant.local:8123,http://homeassistant.local:7071
or is it not possible do override it?

@BenoitAnastay
Copy link
Owner

This setting can be set in /addons_config/ca5234a0_paperless-ngx/paperless.conf

there are two missing urls
This is already the case it does extract the host and use both schemes and ports, I just forgot to add .local to hostname

It should also work with IPs

@MelleD
Copy link
Author

MelleD commented Jan 23, 2024

This setting can be set in /addons_config/ca5234a0_paperless-ngx/paperless.conf

Yes I know I also set this PAPERLESS_OCR_USER_ARGS={"invalidate_digital_signatures": true}. This worked, but not the PAPERLESS_CSRF_TRUSTED_ORIGINS.

It should also work with IPs

You are right, then 4 :)

@BenoitAnastay
Copy link
Owner

You can enable DEBUG to have a more verbose error message

@MelleD
Copy link
Author

MelleD commented Jan 24, 2024

I have no luck so far with the config file. Maybe I just wait for your fix and test again.
"Paper Less" app works so far. The other two are not working but one should be enough :D...
I have just a limit to upload files >10MB was not working. I think this a nginx limit body size limit, correct?

@BenoitAnastay
Copy link
Owner

I'll open another issue for nginx upload limit, the #69 is planned to be fixed with tomorrow update

@BenoitAnastay BenoitAnastay changed the title [Q] Upload via mobile phone 📚 Ingress and API authentification Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation wontfix This will not be worked on
Projects
None yet
2 participants