Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Error when trying to authenticate through API (v14)

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
authenticationapi
5 Réponses
11766 Vues
Avatar
Norb

Hi,

I follow the docs: https://www.odoo.com/documentation/14.0/webservices/odoo.html

I am trying to make a test connection to demo as shown in the example: $info = ripcord::client('https://demo.odoo.com/start')->start();

Everything goes well. I get the host, database, username, and password.

When I call $common->version(); I get the correct response.

But when trying to $uid = $common->authenticate($db, $username, $password, array()); I get the following error:

Traceback (most recent call last): File "/home/odoo/src/odoo/14.0/odoo/addons/base/controllers/rpc.py", line 69, in xmlrpc_2 response = self._xmlrpc(service) File "/home/odoo/src/odoo/14.0/odoo/addons/base/controllers/rpc.py", line 49, in _xmlrpc result = dispatch_rpc(service, method, params) File "/home/odoo/src/odoo/14.0/odoo/http.py", line 140, in dispatch_rpc result = dispatch(method, params) File "/home/odoo/src/odoo/14.0/odoo/service/common.py", line 56, in dispatch return g[exp_method_name](*params) File "/home/odoo/src/odoo/14.0/odoo/service/common.py", line 27, in exp_authenticate return res_users.authenticate(db, login, password, {**user_agent_env, 'interactive': False}) TypeError: 'list' object is not a mapping

What am I doing wrong?

0
Avatar
Ignorer
Norb
Auteur

Thank you, Piotr!

This is a correct answer:

$common = ripcord::client("$url/xmlrpc/2/common");

$version = $common->version();

$uid = $common->authenticate($db, $username, $password, $version);

Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Meilleure réponse

Try to pass JSON as the last argument instead of an array.

$uid = $common->authenticate($db, $username, $password, {});


1
Avatar
Ignorer
Avatar
Piotr
Meilleure réponse

I had the same situation. In my case working solution:

$common = ripcord::client("$url/xmlrpc/2/common");
$version = $common->version();
$uid = $common->authenticate($db, $username, $password, $version);

Please confirm, if this solution works to you.

2
Avatar
Ignorer
Avatar
Norb
Auteur Meilleure réponse

Thank you.

This will trigger PHP Parse error error: $uid = $common->authenticate($db, $username, $password, {});

I tried: $uid = $common->authenticate($db, $username, $password, "{}"); but it triggers similar error:

array(2) { ["faultCode"]=> int(1) ["faultString"]=> string(761) "Traceback (most recent call last): File "/home/odoo/src/odoo/14.0/odoo/addons/base/controllers/rpc.py", line 69, in xmlrpc_2 response = self._xmlrpc(service) File "/home/odoo/src/odoo/14.0/odoo/addons/base/controllers/rpc.py", line 49, in _xmlrpc result = dispatch_rpc(service, method, params) File "/home/odoo/src/odoo/14.0/odoo/http.py", line 140, in dispatch_rpc result = dispatch(method, params) File "/home/odoo/src/odoo/14.0/odoo/service/common.py", line 56, in dispatch return g[exp_method_name](*params) File "/home/odoo/src/odoo/14.0/odoo/service/common.py", line 27, in exp_authenticate return res_users.authenticate(db, login, password, {**user_agent_env, 'interactive': False}) TypeError: 'str' object is not a mapping " }
Any other thoughts?

0
Avatar
Ignorer
Avatar
Jérôme Vanhaudenard (jev)
Meilleure réponse

I tried: $uid = $common->authenticate($db, $username, $password, "{}"); but it triggers similar error:

With the quote around the "{}", you give a string instead of a dict.

 

Actually, python needs a dict to be present (the {}) and it can be empty.

A JSON string will not work.


That part of the code did change recently, making it impossible to give an empty array.

The workaround is to give a named array like this:

array("a"=>"b")


A pull request is in progress to allow an empty array parameter as before.

0
Avatar
Ignorer
Avatar
Chiledar
Meilleure réponse

I am resolved the problem passing in to last parameter the value returned in the method Version. I am programming at C# y the code is this:

OdooVersion vVersion = XmlRpcProxyGen.Create<OdooVersion>(); 
vVersion.Url = this._UrlBase + "/xmlrpc/2/common"; 
object vResult = vVersion.version();
OdooAutenticar proyCall = XmlRpcProxyGen.Create<OdooAutenticar>();
proyCall.Url = this._UrlBase + "/xmlrpc/2/common";
 int vResult2 = proyCall.authenticate(this._BaseDatos.Trim() , this._Usuario.Trim(), this._Password.Trim(), vResult); 
 return vResult2; 

The error only occurs the version 14.
In the version 12 or 13 the call "Authenticate" method runs without problems
0
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
How i can auth my user to access odoo with API Key or Access Token? Résolu
authentication api
Avatar
Avatar
Avatar
Avatar
4
août 24
44749
Question about how to authentication using api key Résolu
authentication api api-key
Avatar
Avatar
1
sept. 25
5455
API authentication not working with API key
authentication api api-key
Avatar
0
janv. 24
4279
How to authenticate users from res.users model in laradoo package
authentication api odoo
Avatar
0
juil. 21
4415
How do I get Product Prices with json API? Résolu
api
Avatar
Avatar
1
nov. 25
2961
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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