---
title: "POST /api/v1/auth"
method: POST
path: "/api/v1/auth"
tags: ["auth"]
---

# POST /api/v1/auth

`POST /api/v1/auth`

Authentication: provide username/password or a keycloak access_token
and get a bearer token in return.

- **username**: Open Food Facts user_id (not email)
- **password**: user password (clear text, but HTTPS encrypted)

- **access_token**: keycloak access_token (clear text)

A **token** is returned. If the **set_cookie** parameter is set to 1,
the token is also set as a cookie named "session" in the response.

To authenticate, you can either:
- use the **Authorization** header with the **Bearer** scheme,
e.g.: "Authorization: bearer token"
- use the **session** cookie, e.g.: "Cookie: session=token"

## Response `200`

- SessionResponse
  - `user_id` string, required
  - `is_moderator` boolean, required
  - `access_token` string, required
  - `token_type` string, required

---

[API](https://skmtc.net/openfoodfacts/apis/open-food-facts-open-prices-rest-api.md) · [All operations](https://skmtc.net/openfoodfacts/apis/open-food-facts-open-prices-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openfoodfacts/open-food-facts-open-prices-rest-api/revisions/2315a270e4e6/schema)
