> For the complete documentation index, see [llms.txt](https://taskflow-1.gitbook.io/taskflow-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://taskflow-1.gitbook.io/taskflow-docs/authentication.md).

# Authentication

How users, integrations, and services prove who they are. Authorization (which project a user may touch) is enforced in `api-service` on every request, on top of the identities established here.

## User sessions (web-app)

* Login issues a short-lived access token (JWT, 15 minutes), presented to `api-service` as a bearer token — the only credential the browser sends, per `system-overview.md`.
* The refresh token lives in an `HttpOnly`, `Secure`, `SameSite=Lax` cookie, is rotated on every refresh, and expires absolutely after 30 days.
* Logout revokes the refresh token server-side; revoked tokens are kept on a Redis deny-list until they would have expired anyway.

## Passwords

* Stored with argon2id; checked against a breached-password corpus at set and reset time.
* Password reset uses a single-use emailed link (1 hour). The email is sent by `worker`; the link carries a token hash, never the email address or user ID in clear text beyond what the link needs.

## API tokens (integrations)

* Created per user from the settings UI; shown exactly once; only a SHA-256 hash is stored.
* Scoped `read` or `write`, and rate-limited as their own class (see `taskflow-api-docs`, `rate-limiting.md`). Tokens carry the prefix `tf_live_` so logs and tooling can tell the credential class apart without seeing the secret.
* Revocation is immediate and is the first step when a token leaks (see `security.md`).

## Service-to-service

* `worker` never calls the public API of `api-service` (a standing boundary in `system-overview.md`); it authenticates to the PostgreSQL read-replica and to Redis with per-service credentials from the secrets manager (see `security.md`).
* Apart from the login and password-reset endpoints themselves, the only unauthenticated endpoint is `GET /health`, which by contract reveals nothing beyond check names (see `taskflow-api-docs`, `api-conventions.md`).

## Admin access

* Administrative actions (including project ownership transfer, an audited action per `taskflow-api-docs`, `data-model.md`) require a fresh MFA challenge (TOTP or WebAuthn) in addition to a live session.


---

# 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://taskflow-1.gitbook.io/taskflow-docs/authentication.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.
