Skip to content

feat(Auth): Added support for keycloak access_token#476

Open
TTalex wants to merge 1 commit intoopenfoodfacts:developfrom
TTalex:access_token_support
Open

feat(Auth): Added support for keycloak access_token#476
TTalex wants to merge 1 commit intoopenfoodfacts:developfrom
TTalex:access_token_support

Conversation

@TTalex
Copy link
Copy Markdown

@TTalex TTalex commented Apr 30, 2026

Description

  • Openfoodfacts api now supports access_token authentication using 'Authorization: Bearer <access_token>' header.
  • This PR offers a third way to auth users (after username/password and session_cookie).

Testing

  • I haven't added unit tests, since existing auth tests are mocked anyways
  • Also, there seem to be differences in the way OFF environments handle the authorization header. The header is ignored in '.net' env, but works well in '.org' env.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@john-gom john-gom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. It might be appropriate to flag the session cookie and username password as deprecated, but that could be done in a follow up PR.

@TTalex when testing on .net did you use a token from auth.openfoodfacts.net?

@github-project-automation github-project-automation Bot moved this from In progress to Reviewer approved in 🐍 Python SDK - Keep on par with the API May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants