# How to authenticate

Authentication is made through a POST request to endpoint api/authenticate. A username and a password are required, which may be created by the application administrator. The administrator may also create granular privileges for this specific user in order to allow only access to certain resources.

Here is a python code snippet for authentication:

def authenticate(base_url: str, username: str, password: str):
    data = {
        "username": username,
        "password": password,
    }

    response = requests.post(f"{ base_url }/authenticate", json=data)
    assert response.status_code == codes.ok

    r = response.json()

    return {"Authorization": f"Bearer { r['access_token'] }"}

The returned authorization access token may then be used for other api calls.