Authenticate via XMLRPC in Odoo from a PHP system
<p>I would like to authenticate into Odoo via xmlrpc but as a SSO kind of implementation. The credentials of the users will be the same in both Odoo and PHP, so basically there will be a redirection to Odoo from the php system when the user is logged in there. The thing is since the passwords are hashed at both the PHP and Odoo side, there is no way to pass the password from php to odoo. I know that authentication can be done if the username and password is passed, but this isnt the case here, so is there any way to implement an SSO for the above scenario?</p>

<p>Thanks And Regards,</p>

<p>Yaseen Shareef</p>

<p>Odoo supports other authentication mechanisms than local passwords, out-of-the-box:</p>

<ul>
<li>LDAP authentication is provided by the built-in <a href="https://www.odoo.com/apps/modules/8.0/auth_ldap/" rel="nofollow"><code>auth_ldap</code></a> module. It requires an external LDAP service, such as <a href="http://www.openldap.org" rel="nofollow">openldap</a> or a Microsoft Active Directory. It works at the XML-RPC level as well, because it is a password-based mechanism.</li>
<li>OAuth2 authentication is provided by the built-in <a href="https://www.odoo.com/apps/modules/8.0/auth_oauth/" rel="nofollow"><code>auth_oauth</code></a> module. It requires an external OAuth2 provider, such as Google or Facebook accounts. This does not work transparently at the XML-RPC level, because it is not strictly password-based. You need to do the OAuth authentication of an HTTP session first, and then you can use the JSON-RPC API to remotely access Odoo as you would with XML-RPC.</li>
<li>Odoo 8 also includes built-in support for OpenID integration, via the <a href="https://www.odoo.com/apps/modules/8.0/auth_openid/" rel="nofollow"><code>auth_openid</code></a> module. This requires an external OpenID service, but has been deprecated as of Odoo 9 in favor of the equivalent OAuth services. Similarly to OAuth, it is not password-based so it will not work at the XML-RPC level directly.</li>
</ul>

<p>The Odoo API is fully accessible through either XML-RPC or JSON-RPC, these are strictly equivalent. There are RPC libraries for each in most languages, and popular languages often have dedicated Odoo RPC libraries.</p>

<p>You can easily achieve SSO on Odoo and your PHP application by using one of these external authentication mechanisms, as there are PHP libraries for each of them. You just need to choose a suitable provider for your case.</p>

<p>In addition third-party community modules exist for other authentication mechanism (look <a href="https://github.com/OCA/server-tools/tree/8.0" rel="nofollow">here</a> for starters). For example, for version 7.0 there was a module that would authenticate in Odoo based on the HTTP Basic authentication (<code>auth_from_http_basic</code>), allowing for SSO based on the web server' pluggable authentication. I don't think it was ported for version 8, but you can perhaps contact the authors and help get it done.</p>

php python openerp odoo-8 xml-rpc