LeoKlaus / Paperparrot

A native Swift app to manage all your documents. Fully compatible with Paperless-ngx
https://paperparrot.me
115 stars 0 forks source link

Setup Connection to NGX server - not working :/ #137

Closed LeoKlaus closed 1 year ago

LeoKlaus commented 1 year ago

Discussed in https://github.com/LeoKlaus/Paperparrot/discussions/136

Originally posted by **SuperUschi** October 12, 2023 Hi community, I have issues to connect to my local ngx server and get a "server responded: 400" and "URLSession returned error: ". Since there is no wiki or setup document I am a bit lost ;-) I have used IP:8010 or IP:8080 with right credentials. I have full access to my server via webpage. Maybe I am missing some settings at docker (portainer +compose)? Many thanks for support
LeoKlaus commented 1 year ago

HTTP 400 indicates that the server couldn't handle the request, which is weird.

Can you check the logs for your Webserver container? They should contain more information.

Other than that, make sure you've selected the proper protocol (http for local connections). The URL should look like this: 192.168.1.123:8080 (no trailing slash, no protocol) What port do you use to access the WebUI? Is http://{IP-of-your-server}:{port}/api/ reachable in your browser?

SuperUschi commented 1 year ago

Hey LeoKlaus, thanks for picking this up!

WebUI is "http://192.168.178.74:8010/dashboard" Log from Webserver: [2023-10-12 11:42:59,840] [INFO] [paperless.auth] Login failed for user PaperlessAdmin from private IP 192.168.178.79. [2023-10-12 11:42:59,844] [WARNING] [django.request] Bad Request: /api/token/

my credentials are right...

You are referring to port 8080 I am using 8010 for my WebUI... When I look into my compose script:

webserver: ... ports:

Do I have to change here my script to different port setting?

Many thanks

LeoKlaus commented 1 year ago

You shouldn't have to change anything in your compose script.

A 400 response from the /api/token/ endpoint usually indicates wrong credentials. Is the user PaperlessAdmin a superuser on your instance?

Can you try the following command on a Linux machine in your network (for example the server that runs Paperless)? Replace "your-password" with the password for your Paperless user.

curl --request POST \
  --url http://192.168.178.74:8010/api/token/ \
  --header 'Content-Type: application/json' \
  --data '{
    "username": "PaperlessAdmin",
    "password": "your-password"
}'

If the response doesn't look like this {"token":"4aabxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx84bc"}, please tell me what it says.

SuperUschi commented 1 year ago

Well, well, well...

superuser -> this was the issue. I was not aware of that missing piece (had some restrictions) -.- shame on me Now it worked at the first go.

Apologies for the circumstances.

Greetings from Rheinhessen -> 15km west from you :-D (just saw the imprint) btw. all features activated just to support your effort!

LeoKlaus commented 1 year ago

superuser -> this was the issue. I was not aware of that missing piece (had some restrictions) -.- shame on me Now it worked at the first go.

Glad it worked! Generally, the user you use with Paperparrot doesn't have to be a superuser, but I've been unable to find what permission is needed and the Paperless documentation sadly doesn't have any info on that either.

Vielen Dank für Deine Unterstützung ;)