API使用令牌对odoo进行身份验证 [英] API authenticate to odoo with token

查看:560
本文介绍了API使用令牌对odoo进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用令牌从快速应用程序向Odoo进行身份验证.我正在使用 odoo-xmlrpc 节点模块将Odoo与 我的快递应用程序. Odoo要求该API的用户经过身份验证,然后才能使用任何其他API.并且节点模块提供了此功能

I want to authenticate to Odoo from an express application using token. I am using odoo-xmlrpc node module to connect Odoo with my express app. Odoo requires users of the API to be authenticated before they can use any other API. And this node module provides this function

     const odoo = new Odoo({
      url: config.odooUrl,//odoo url
      db: config.odooDB,//odoo db path
      username: "john@gmail.com",
      password: "john_pass123"
    });
      odoo.connect(function(err, uid) {
      if (err) {
        errors.auth = "invalid cridentials";

        return res.status(400).send(errors);
      }
      //execute something from/to odoo server
     })

问题是,每次我想执行Odoo命令时都必须输入用户的凭据.如果我存储用户密码,它将以纯文本格式存储. 我的问题是,他们是否可以通过API使用基于令牌的Odoo身份验证.或解决我的问题的其他任何替代方法

The problem is, I have to enter the user's credentials every time I want to execute an Odoo command. And if I store the user's password it would be stored as a plain text. My question is, is their token-based authentication to Odoo that can be used through API. Or any other alternative solution to my problem

推荐答案

不幸的是,当前在Odoo中没有好的解决方案.此请求请求中正在进行支持api令牌访问和2要素身份验证的工作: https ://github.com/odoo/odoo/pull/33928 .

Currently in Odoo unfortunatelly there is no good solution to this. There is work in progress for support for api token access and 2-factor authentication in this pull request: https://github.com/odoo/odoo/pull/33928.

应用商店中还存在多个支持令牌身份验证的Odoo rest api模块.您可以使用搜索"rest api"或"token"找到这些.对我而言,这些都不适合我的用例.我期待在Odoo社区中对此获得本地支持.

There are also multiple Odoo rest api modules in app store that support token authentication. You can find these with seach "rest api" or "token". To me none of these have been perfect for my use-cases. I look forward to get native support for this in Odoo Community.

这篇关于API使用令牌对odoo进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆