Skip to main content

Beta License: AGPL-3 sygel-technology/sy-rest-framework

This module provides FastAPI Depends to allow authentication with Odoo’s API Keys.

Table of contents

Usage

FastAPI API Key Dependencies

The following FastAPI dependencies are provided and importable from odoo.addons.fastapi_auth_odoo_api_key.dependencies:

def apikey_authenticated_partner_impl() -> Partner

Return the authenticated partner based on the provided API key. Raise a 401 (unauthorized) if the API key is invalid or the partner could not be found. Also validates that the user associated with the API key matches the endpoint’s expected user, if specified.

def apikey_optionally_authenticated_partner_impl() -> Partner | None

Return the authenticated partner based on the provided API key, or an empty recordset if the key is valid but doesn’t match the expected user. Returns None if authentication fails silently.

def apikey_authenticated_partner_env() -> Environment

Return an Odoo environment bound to the authenticated partner. The partner must be authenticated using apikey_authenticated_partner_impl. Raise a 401 if authentication fails.

def apikey_authenticated_partner() -> Partner

Return the authenticated partner bound to the correct Odoo environment. This function uses the partner returned by apikey_authenticated_partner_impl and binds it to the environment returned by apikey_authenticated_partner_env.

def apikey_optionally_authenticated_partner_env() -> Environment

Return an Odoo environment bound to the optionally authenticated partner, or a default environment if the partner could not be authenticated.

def optionally_authenticated_partner() -> Partner | None

Return the optionally authenticated partner bound to the appropriate environment, or None if no valid API key was provided.

Known issues / Roadmap

  • Unit tests of the connection and authorization should be added

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Sygel

Contributors

  • Sygel:

    • Alberto Martínez

    • Valentin Vinagre

    • Harald Panten

Maintainers

This module is part of the sygel-technology/sy-rest-framework project on GitHub.

You are welcome to contribute.

Metadata

Release files for odoo-addon-fastapi-auth-odoo-api-key 17.0.1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo-addon-fastapi-auth-odoo-api-key 17.0.1.1.0
File Interpreter ABI Platform
odoo_addon_fastapi_auth_odoo_api_key-17.0.1.1.0-py3-none-any.whl Python 3 none any Details

Release files / odoo_addon_fastapi_auth_odoo_api_key-17.0.1.1.0-py3-none-any.whl

Download URL odoo_addon_fastapi_auth_odoo_api_key-17.0.1.1.0-py3-none-any.whl
Size 43.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e2ea8bf58a40dbc602f724e6c9c1ed9b15051e26421a46ba24f2feadfccf807
BLAKE2b-256 checksum
How to use checksums
f09a06dc827af55384f141e22f2b8dcf7c7848e31bd4d9e29b3baa6b28f79b14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

17.0.1.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page