> For the complete documentation index, see [llms.txt](https://icij.gitbook.io/datashare/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://icij.gitbook.io/datashare/server-mode/user-management/basic-with-a-database.md).

# Basic with a database

{% hint style="warning" %}
This filter is superseded by the [HTML form auth filter](/datashare/server-mode/user-management/form-auth.md), which offers a nicer login experience and supports sign-out. It is the recommended way to authenticate users backed by the database. This page is kept for reference and existing deployments.
{% endhint %}

Basic authentication is a simple protocol that uses HTTP headers and the browser to authenticate users. User credentials are sent to the server in the `Authorization` header with `user:password` base64-encoded:

```
Authorization: Basic dXNlcjpwYXNzd29yZA==
```

{% hint style="warning" %}
Credentials are sent in plain text (base64 is not encryption). Always run Datashare behind TLS when using this filter.
{% endhint %}

## Database setup

On the server side, you need to provide a database user inventory. Launching Datashare first with the full database URL will automatically migrate the schema. Datashare supports SQLite and PostgreSQL. **SQLite is not recommended** for multi-user servers because it cannot be multithreaded and will cause contention on user lookups.

See [Provisioning users](/datashare/server-mode/user-management.md#provisioning-users) for how to hash passwords, structure user records, and insert them into the `user_inventory` table.

## Login experience

When accessing Datashare, the browser prompts with its native basic-auth popup:

<figure><img src="https://i.imgur.com/qec6c2k.jpg" alt="Screenshot of an &#x27;authentication required&#x27; window with username and password fields and &#x27;Cancel&#x27; and &#x27;OK&#x27; buttons"><figcaption><p>basic auth popup</p></figcaption></figure>

There is no sign-out: users remain logged in until the browser is closed.

## Example

Launching Datashare with Docker and the basic-auth filter backed by the database:

```
docker run -ti ICIJ/datashare --mode SERVER \
    --batchQueueType REDIS \
    --dataSourceUrl 'jdbc:postgresql://postgres/datashare?user=<username>&password=<password>' \
    --sessionStoreType REDIS \
    --auth basic \
    --authUsersProvider database
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://icij.gitbook.io/datashare/server-mode/user-management/basic-with-a-database.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
