Skip to content

API unable to authenticate after updating Inventree #233

@JacobEFO

Description

@JacobEFO

Hi,

After I recently updated Inventree to the latest stable version and the API to 0.14.0 all my API based scripts have problems authenticating yielding a server connection issue. More precisely I get the following error:

Server connection error: <class 'requests.exceptions.ConnectionError'>
InvenTree server is not connected. Skipping authentication check
Traceback (most recent call last):
  File "/Users/jefo/MEGA/Electronics/PowerGaard/kicad/database/pgdb/mwe.py", line 4, in <module>
    api = InvenTreeAPI("http://inventree.localhost", username="root", password="jefo123")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jefo/anaconda3/lib/python3.11/site-packages/inventree/api.py", line 77, in __init__
    self.connect()
  File "/Users/jefo/anaconda3/lib/python3.11/site-packages/inventree/api.py", line 131, in connect
    raise ConnectionError("Authentication at InvenTree server failed")
ConnectionError: Authentication at InvenTree server failed

I've gone down to a minimum example of the following code, where I have replaced username and password:

from inventree.api import InvenTreeAPI

if __name__ == "__main__":
    api = InvenTreeAPI("http://inventree.localhost", username="username", password="password")

I have also tried accessing with a token that worked last week on an older version of Inventree (v14.2 I believe it was). I am wondering why it states: 'InvenTree server is not connected.' because I have access to it on the new platform https://inventree.localhost/platform or the old GUI on https://inventree.localhost.

I have similarly tried accessing with pots 1337 and 8000 but unsurprisingly they do not work, as I have not specified any specific link in the INVENTREE_URL_SITE environment variable. Switching between http and https and using other combinations for the server address such as <URL>/api, <URL>/platform/api etc. similarly yield nothing.

Do you have any ideas what's going on?

Version info
Macos Monterey: 12.7.5
Inventree source code SHA: 9f35971db17e1660fcd27c752558d41952a3e541
Inventree API: 0.14.0
Docker:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions