OCA / odoorpc

Python module to pilot your Odoo servers through JSON-RPC.
http://pythonhosted.org/OdooRPC/
GNU Lesser General Public License v3.0
228 stars 121 forks source link

odoorpc.error.RPCError: Access Denied when using API Key #64

Open fotisp opened 2 years ago

fotisp commented 2 years ago

When using the new "API Keys" functionality on Odoo 14.0, the authentication fails with an authentication denied error message.

#
# # Prepare the connection to the server
odoo = odoorpc.ODOO('localhost, port='8069')

odoo.login('odoo', 'admin', 'b934327276dca39fe1081327bf3f8e8b780da22e0')

The error

File "/tmp/src/odoorpc/odoo.py", line 345, in login
{'db': db, 'login': login, 'password': password},
File "/tmp/src/odoorpc/odoo.py", line 274, in json
data['error']['data']['message'], data['error']
odoorpc.error.RPCError: Access Denied python-BaseException

The same code with the actual user password works fine.

Furthermore the vanilla code

import xmlrpc.client

url = 'http://localhost:8069'
db = 'odoo'
username = 'admin'
password = 'b934327276dca39fe1081327bf3f8e8b780da22e0'

common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
common.version()

uid = common.authenticate(db, username, password, {})
print(common.version())

print(uid)

Works just fine.

I have tried this in Master.

fotisp commented 2 years ago

This is caused by this https://github.com/odoo/odoo/issues/75331 unless I am missing something.

fotisp commented 2 years ago

Ok so based on odoo/odoo#75331, OdooRPC is using the session based authentication. Should I close this, or keep it open for future reference?

bizzappdev commented 2 years ago

@fotisp does this mean OdooRPC will not work with API Key?

fotisp commented 2 years ago

Hello @bizzappdev, yes it won't work right now

sebalix commented 1 year ago

I want to implement this for release v0.10.0, I won't have time to add this for the upcoming v0.9.0 that will be published in a couple of days. So I keep this issue open.

Vonken commented 8 months ago

Using the REST API from Postman using the url "/web/session/authenticate" and having the same issue. Access Denied when using the API Key insted of the password.

flotho commented 1 month ago

need to be closed as it's the expected behaviour from Odoo