SID (session id ) changed when call new API

蓝咒 提交于 2019-12-11 18:45:06

问题


I would like to save the login session as I switch between several windows Here is my authentication code:

PROCÉDURE connexion()

    MyErreur est un booléen
    :MaRequeteConnexion..Entête["Content-type"] = "application/json"
    :MaRequeteConnexion..URL = "http://"+:p_ipserveur+"/web/session/authenticate"
    :MaRequeteConnexion..Méthode =httpPost
    :demande_connexion.params.db = "Mydatabase"
    :demande_connexion.params.login ="test"
    :demande_connexion.params.password = "test"
    :MaRequeteConnexion.Contenu = :demande_connexion..FormatJSON
    :cReponseRequest = RESTEnvoie(:MaRequeteConnexion)
    vRes est un Variant
    //convert_response_to_get_items
    vRes=JSONVersVariant(:cReponseRequest.Contenu)
    //check if user exist
    active_user = vRes.result.uid
    session_id = vRes.result.session_id
    // session_id = ecbb489c2d5e5903f8fc341e6f5121141b6f94b0

    // -------- click on the login button------

    OuvreSoeur(FEN_MENU)

the menu contains buttons every time i need to consume web services i can't , here is an example of a procedure

PROCÉDURE get_child()

:MaRequeteConnexion..Entête["Content-type"] = "application/json"
:MaRequeteConnexion..URL = "http://"+:p_ipserveur+"/api/employee"
:MaRequeteRequest..DuréeNonRéponse = :p_timeout

:demande_connexion.jsonrpc = "2.0"
:demande_connexion.method = "call"
//params 1043 pour le test et lid existe
:demande_connexion.params.employe_id="1043"
:MaRequeteConnexion.Contenu = :demande_connexion..FormatJSON
:cReponseRequest = RESTEnvoie(:MaRequeteConnexion)
vRes est un Variant
//convert_response_to_get_items
vRes=JSONVersVariant(:cReponseRequest.Contenu)

:cReponseRequest.contenu return the below

{
"jsonrpc":"2.0",
"id":null,
"error":
{
"message":"Odoo Session Expired",
"code":100,
"data":
{
}

NB : I use (ERP) ODOO(postgressql).

Thanks in advance for the answer.

来源:https://stackoverflow.com/questions/59191576/sid-session-id-changed-when-call-new-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!