Code Monkey home page Code Monkey logo

Comments (10)

jonaswinkler avatar jonaswinkler commented on May 21, 2024 2

Can you confirm that

curl --user <username> https://paper.host.tld/paperless/api/documents

works? It should return a large list of documents.

Don't forget trailing slashes. I think they are required.

from paperless_app.

bauerj avatar bauerj commented on May 21, 2024 1

Thanks for posting the solution! This should probably be changed in the documentation(s).

Edit: I see you're already one step ahead here 😄

from paperless_app.

bauerj avatar bauerj commented on May 21, 2024

Hey Robert,

do you use a reverse proxy in front of paperless?

from paperless_app.

Whisprin avatar Whisprin commented on May 21, 2024

I'm using Apache and mod_wsgi like described here: https://paperless.readthedocs.io/en/latest/setup.html#making-things-a-little-more-permanent
But I changed Alias to /paperless/static and WSGIScriptAlias to /paperless.

from paperless_app.

bauerj avatar bauerj commented on May 21, 2024

Can you confirm that

curl --user <username> https://paper.host.tld/paperless/api/documents/

works? It should return a long list of documents.

Edit: This originally did not include the slash at the end.

from paperless_app.

Whisprin avatar Whisprin commented on May 21, 2024

Using curl I get a redirect to location: /paperless/api/documents/ and then the same error:

< HTTP/2 403
{"detail":"Authentication credentials were not provided."}

With correct, incorrect and no password it's the same response.

When I open this URL logged in the browser it works:

GET /paperless/api/documents/

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "count": 44,
    "next": "https://paper.host.tld/paperless/api/documents/?page=2",
    "previous": null,
    "results": [
        {
            "id": 28,
            "correspondent": null,
            "title": "0120",
...

from paperless_app.

bauerj avatar bauerj commented on May 21, 2024

Thanks for confirming. This looks like a server issue then. The browser uses a different authentication mechanism with cookies which is why it works fine there.

It's not quite clear to me why this doesn't work but then again I don't work much with Apache.

from paperless_app.

jonaswinkler avatar jonaswinkler commented on May 21, 2024

try

curl --user <username> --basic https://paper.host.tld/paperless/api/documents/

which should ask you for your password and verify that authentication works.

from paperless_app.

Whisprin avatar Whisprin commented on May 21, 2024

Thanks, yes with and also without --basic the password prompt appears:

Enter host password for user 'myuser':

The response is the same as above.

from paperless_app.

Whisprin avatar Whisprin commented on May 21, 2024

I got it!
Thanks for nudging me in the right direction. I didn't know that the API uses basic auth.

In order to have basic auth working with wsgi this is needed in the apache conf: WSGIPassAuthorization On.

https://www.django-rest-framework.org/api-guide/authentication/#setting-the-authentication-scheme

Created a PR to the documentation. Now on to try the app :)

from paperless_app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.