Not saving cookies on chrome extension

201 views
Skip to first unread message

Suchintan Das

unread,
Nov 17, 2021, 11:33:44 PM11/17/21
to Chromium Extensions
I am a bit new to chrome extension API, in my current project I faced one issue with the manifest version 2 of a chrome extension that it was not saving the cookies that were been sent from my backend. Mostly in websites, I have seen that after logging in or signing up the cookies are saved on their own on the backend but while I perform the same it is not saving cookies on either of them.

Can anyone tell me how I save the cookies from the chrome extension and why this issue is happening on the chrome extension?

Sign in

var form = $("#sign-in");
$( "#sign-up" ).submit(function( event ) {
  event.preventDefault();
  var post_data = getFormData(form);
  post_data["username"] = post_data["email"]
  $.ajax({
    type: "POST",
    data: JSON.stringify(post_data),
    success: function () {
        chrome.pageAction.setPopup({popup: "../pages/preference.html"});
    },
    dataType: "json",
    contentType : "application/json"
});
});

PhistucK

unread,
Nov 18, 2021, 1:00:09 PM11/18/21
to Suchintan Das, Chromium Extensions
You might need withCredentials: true, or/and sameSite=none; secure; as part of the cookie, or/and to add host permissions for that remote domain.

PhistucK


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/f233e0a2-b443-4300-a67c-d9e0446e67een%40chromium.org.

Suchintan Das

unread,
Nov 25, 2021, 12:00:23 PM11/25/21
to Chromium Extensions, PhistucK, Chromium Extensions, Suchintan Das
The error is fixed now. Actually chrome extensions don't create cookies on their own. So the cookies needs to be generated on the website only.

Thanks

Reply all
Reply to author
Forward
0 new messages