> 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

Basic authentication 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://2881303961-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LWCyd3pDXO_H4jk9DgG%2Fuploads%2FUI4KGRELWNixy29BfK3m%2FScreenshot%20from%202026-09-04%2011-11-28.png?alt=media&amp;token=937ab027-970c-4e90-bf0d-122d7dc81450" alt="basic auth popup"><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 app start --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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
