Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Custom code: KEY invalidate Authentication - Odoo18

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
1 Odpowiedz
1304 Widoki
Awatar
Mohammed

I'm trying to send a request to an external API using a custom header named "KEY" for authentication.


When testing the same request using Postman or a standalone Flask script, everything works correctly. However, when sending the request from within Odoo (using Python `requests`), the server always responds with:

`401 - The authorization key is invalid`


It seems like Odoo or the hosting environment is blocking or stripping the "KEY" header from the request.


I’ve tried alternatives like "x-api-key", "X_KEY", and others, but none of them worked.


Is there a known limitation in Odoo regarding custom headers like this? Any advice or workaround would be appreciated.

0
Awatar
Odrzuć
Christoph Farnleitner

What's your actual source?

Christoph Farnleitner

No, I did not encounter an issue like this using requests. There shouldn't be anything blocking from Odoo either. Also, I meant to ask what your source is - how are you calling that API exactly. Because your issue most likely lies in there. The key obviously should not be shared, but all the rest would be helpful to get a picture of what you are actually sending - and how you do that. Also, share the specs of the API and how authentication is supposed to happen as well. Maybe there's just a misunderstanding on that one.

Christoph Farnleitner

~~ I don't know how I managed to post my question as an answer, hence converted it to a comment and re-created reply for Mohammed ~~

Mohammed (Autor)
Hi Christoph,

Thanks for your reply.

The source is a third-party API that requires a custom header named KEY for authentication. The same request works perfectly when tested via Postman or a Flask script, but fails with a 401 error when triggered from inside Odoo using requests.

I’m trying to figure out whether Odoo or its internal server environment is blocking or stripping the KEY header.

Let me know if you’ve seen this kind of behavior or have suggestions

Christoph Farnleitner

About your log - sorry for the confusion, I meant the on on the API endpoint which you're trying to authenticate at. But also on your end you can do a verbose debug logging on the request, i.e. https://stackoverflow.com/questions/10588644/how-can-i-see-the-entire-http-request-thats-being-sent-by-my-python-application

Mohammed
Autor

Yes, exactly — the issue seems to lie in how Odoo (or possibly Werkzeug behind it) handles or strips custom headers like KEY when making requests using Python’s requests library from within Odoo’s environment. The same request works fine outside (Postman / Flask), but always triggers a 401 Unauthorized when called from inside Odoo.

I’m currently investigating possible middleware or proxy behaviors that could interfere with custom headers. If you’ve encountered similar behavior with requests inside Odoo or have recommendations (e.g., using http.client, overriding headers handling, or adjusting WSGI configurations), I’d truly appreciate your input.

Thanks again for your help!

Awatar
Mohammed
Autor Najlepsza odpowiedź

Hi Christoph,


Thank you for your reply and insights.


I can confirm that the API expects the header key as "KEY" in all uppercase. In my Postman tests, the request only succeeds when the header is exactly:


    KEY: [dummy_key_used_here]


(That key is just a placeholder — in production I use a different value.)


Using "Key" or "key" returns an authentication failure. 

The body works with both `form-data` and `application/json`, but in my Odoo plugin I’m using JSON with the required headers, and it's working successfully outside of Odoo.


Appreciate your help as always!


Best regards, 

Mohammed

0
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now