Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Custom code: KEY invalidate Authentication - Odoo18

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
1 Răspunde
1316 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
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!

Imagine profil
Mohammed
Autor Cel mai bun răspuns

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
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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