auth

POST /api/v1/auth

Changed on

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 "opsession" in the response.

To authenticate, you can either:

  • use the Authorization header with the Bearer scheme, e.g.: "Authorization: bearer token"
  • use the opsession cookie, e.g.: "Cookie: opsession=token"

Request

  • Base URL
    https://prices.openfoodfacts.org (the document declares no server; this is the origin it was published from)
  • URL
    https://prices.openfoodfacts.org/api/v1/auth
  • Auth
    none declared

Query parameters

set_cookie1

Set to 1 to also return the access token in an "opsession" cookie.

Request body application/x-www-form-urlencoded

usernamestring
passwordstring
access_tokenstring

Response

user_idstring required
is_moderatorboolean required
access_tokenstring required
token_typestring required

Changes

    • info

      added the new optional query request parameter set_cookie

    • info

      added the new optional request property (media type: application/x-www-form-urlencoded)

    • info

      added the new optional request property (media type: multipart/form-data)

    • info

      request body became optional

    • info

      the request property became optional (media type: application/x-www-form-urlencoded)

    • info

      the request property became optional (media type: multipart/form-data)

    • info

      the request property became optional (media type: application/x-www-form-urlencoded)

    • info

      the request property became optional (media type: multipart/form-data)

    • info

      the request required property became write-only (media type: application/x-www-form-urlencoded)

    • info

      the request required property became write-only (media type: multipart/form-data)

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status