UPDATE: TO Admins, can you please close or delete post.
the problem description was wrong.
my problem is now sorted but it wasn't the one i described below
Hello,
I working on the app which tries to login to my odoo backend on different hosting.
but when i try to login, I receive error : CORS preflight response did not succeed). Status code: 400.
my request contains following:
method: "POST",
headers: { "Content-Type": "application/json",
"Accept": "application/json",
"Access-Control-Allow-Origin": this.#origin },
data: {
'jsonrpc':"2.0",
'params':
{
'db': this.#db,
'login':username,
'password':password,
},
},
withCredentials: true,
crossDomain: true,
baseURL: this.#base_url,
url: "/web/session/authenticate"
but because of CORS policy, browser sends another OPTIONS request to server with content-type text/html; charset=utf-8 therefore I receive an error:
/web/session/authenticate: Function declared as capable of handling
request of type 'json' but called with a request of type 'http'
anybody know how to overcome this problem?