How to pass cookie/session id in dio resquest?

Hi Guys,
I am wandering that how could I send my session Id from login to other rest api calls in flutter. My Situation here is I want to have a login screen and Products list page. I get success with developing Login page with authentication. Here is the code snippet

Login Button:

          onPressed: () {
            ApiProvider().userLogin().then((value) => {});
          child: Text('Login'),

ApiProiver.dart :

 Future userLogin() async {
   var options = Options(
    headers: {"Content-Type": "application/json"},
  var body ={
   "jsonrpc" : "2.0",

 Response response = await'',options:options, 
 data: body);
 print("Response $response");
 final cookies =['set-cookie'];


  Response :

  {"jsonrpc": "2.0", 
    "id": null,
            {"uid": 2, 
             "is_system": true, 
             "is_admin": true, 
             "db": "food_app",   
            "name":  "Administrator", 
            "username": "admin", 
           "web.base.url": "",

Cookie :

[session_id=d446d3ef6bd536ef8e0bf6f1c9ba3a40c92ccb99; Expires=Thu, 21-Jan-2021 08:59:42 
GMT; Max-Age=7776000; HttpOnly; Path=/]

Result is ok!!!!!!!!!!!!!!!

I get cookies/session id from the above code now my question is how could I pass the session id to the next api calls

Future fetchProducts() async {
 var options = Options(
   headers: {"Content-Type": "application/json"},
  var body =
       "jsonrpc" : "2.0",
      "params":{ }
  Response response = await'',options: options, data:body );

Here is the python test scripts which accepts the above api call :slight_smile:

 odoo_url = ""

 headers = {'Content-type': 'application/json'}

 myobj = {"jsonrpc":"2.0","params":{'db':'food_app','login':'admin','password':'admin'}}
 session_details = requests.get(url=odoo_url + '/web/session/authenticate', data=json.dumps(myobj), 
 session_id = str(session_details.cookies.get('session_id'))
 print("Session id")
 cookies = {
 'session_id': session_id


 url_get = ''
 headers = {'Content-type': 'application/json'}
get_products = requests.get(url_get, cookies=cookies)
json_data = json.loads(get_products.text)
for product in json_data['response']:

the above python code hits the api and return the correct response

Session :

Product Names:
Calamari & Rice in Orange Souce
Chicken Wings in Buffalo Sauce
Mixed Vegatables, Paprika & Chips - Dish 1
New York Strip Steak  
Roasted Brussels Sprout Salad
Salmon in Carrot Souce
Vegetable Salad with Avocado & Rice

Please edit my fetchProducts() method in order to get the response from api with session.

Hello, Could you find the solution? I am having the same problem.