Auth
Auth_create
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"
Query Parameters
set_cookie?integer
Set to 1 to also return the access token in an "opsession" cookie.
Value in
1username?string
password?string
access_token?string
Response Body
curl -X POST "https://loading/api/v1/auth?set_cookie=1" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d ''{
"user_id": "string",
"is_moderator": true,
"access_token": "string",
"token_type": "string"
}