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

Web service API with ripcord

Abonare

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

Această întrebare a fost marcată
phpxmlrpcwebserviceCSRF
2 Răspunsuri
14038 Vizualizări
Imagine profil
Nicolás Mena

Hello, 


I'm trying to do a simple test with ripcord and php to login and get info of my installation of odoo 9.0  with the following script


[xmlrpc_test.php]

<?php
$url = "http://localhost.8069";
$db = "odoo9";
$username = "admin";
$password = "mypassword";
require_once('include/ripcord/ripcord.php');
$info = ripcord::client('http://127.0.0.1:8069')->start();
list($url, $db, $username, $password) = array($info['host'], $info['database'], $info['user'], $info['password']);
?>


But when I open the php file on the browser i get this message on the console of Eclipse


Odoo URLs are CSRF-protected by default (when accessed with unsafeHTTP methods). Seehttps://www.odoo.com/documentation/9.0/reference/http.html#csrf formore details.
* if this endpoint is accessed through Odoo via py-QWeb form, embed a CSRF token in the form, Tokens are available via `request.csrf_token()` can be provided through a hidden input and must be POST-ed named `csrf_token` e.g. in your form add:
      <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
* if the form is generated or posted in javascript, the token value is available as `csrf_token` on `web.core` and as the `csrf_token` value in the default js-qweb execution context
* if the form is accessed by an external third party (e.g. REST API endpoint, payment gateway callback) you will need to disable CSRF protection (and implement your own protection if necessary) by passing the `csrf=False` parameter to the `route` decorator.
2017-03-01 15:17:40,142 7776 INFO ? werkzeug: 127.0.0.1 - - [01/Mar/2017 15:17:40] "POST / HTTP/1.0" 400 -
2017-03-01 15:17:40,286 7776 WARNING ? openerp.http: No CSRF validation token provided for path '/'

Reading the documentation mentioned in the message (https://www.odoo.com/documentation/9.0/reference/http.html#csrf) seems i have to create a controller to handle the connections from a "third party" code, here's my question:


How and where I have to create that web controller to deactivate the csrf protection ? If you can help me with some examples or links with more info I'll be grateful.


Best regards




0
Imagine profil
Abandonează
Imagine profil
Nicolás Mena
Autor Cel mai bun răspuns

Thanks Axel, I've tryed that correction but now i get a 404 error in the console, that works in the same way for odoo.com instances and a standalone installation? 

I've tryed /start and /xmlrpc routes.


2017-03-02 14:55:40,120 27569 INFO ? werkzeug: 127.0.0.1 - - [02/Mar/2017 14:55:40] "POST /start HTTP/1.0" 404 -2017-03-02 14:56:01,261 27569 INFO ? werkzeug: 127.0.0.1 - - [02/Mar/2017 14:56:01] "POST /xmlrpc HTTP/1.0" 404 -

Best Regards


EDIT: This problem was solved, i've reviewed my DB credentials and now it's working ok    

0
Imagine profil
Abandonează
Imagine profil
Axel Mendoza
Cel mai bun răspuns

The thing is that you are not correctly using the start demo described here:

http://www.odoo.com/documentation/9.0/api_integration.html

To fix it just use this url like described in the docs

$url = "http://localhost.8069/start";

and keep the rest of your code, CSRF is another topic and you wouldn't reach it when using remote api, if you see a result asking for the csrf_token it's because your request is getting attended by an Odoo Web Controller instead of the services layer and you need to review your url like this case

1
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
Related Posts Răspunsuri Vizualizări Activitate
Fatal error: xmlrpc_encode_request(): XML-RPC doesn't support circular references in ripcord_client.php
php xmlrpc webservice odoo
Imagine profil
0
ian. 16
7850
OpenERP 7.0 WebService : search_read()
php xmlrpc 7.0 webservice
Imagine profil
Imagine profil
2
iun. 15
7195
XMLRPC WITH PHP
php xmlrpc
Imagine profil
0
mar. 18
4942
Openerp xmlrpc PHP insert into re.users with company_id
php xmlrpc
Imagine profil
Imagine profil
2
mar. 15
11300
How to identify record is created from xmlrpc script(php) when create method overrite
php xmlrpc
Imagine profil
Imagine profil
1
mar. 15
8542
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