How to change domain and still have SSO (linkedin, facebook) work

I changed my domain from oneseed.green to impact.oneseed.eco and then used a 302 redirect to ensure SEO worked.
The problem is that when you do that the bubble cookies are all forwarded and the problem with that is that bubble doesn’t like it. So when you relogin with Oauth, it looks like it works but the user status remains logged out.

Bubble cookies are httponly, so you can’t use javascript to reset them. It has to come from the server. There aren’t any 302 redirect services that mess with cookies so i had to write my own.

So basically if you are migrating domains and use SSO and don’t want to have to walk your users through clearing their cache in their browsers (what Bubble says in their docs). You need to write your own 302 redirect on the old domain but clear all the bubble cookies right before. Most browsers will honor the cookie settings right before the redirect.

bubble cookies all begin with you app name, and are httpsonly, secure with path “/”, samesite is none and domain begins with a dot

Here is the code in .net I used to clear the cookies…
foreach (var cook in req.Cookies)
{

 if (cook.Key.StartsWith("aptivleadchain"))
 {
     CookieOptions cop = new CookieOptions();
     cop.Domain = ".oneseed.green";
     cop.Expires = DateTime.UtcNow.AddDays(-4);
     cop.HttpOnly = true;
     cop.Secure = true;
     cop.Path = "/";
     cop.SameSite = SameSiteMode.None;

     if (req.HttpContext != null && req.HttpContext.Response != null && req.HttpContext.Response.Cookies != null)
     {
         try
         {
             req.HttpContext.Response.Cookies.Delete(cook.Key);
         }
         catch (Exception)
         {
         }
         req.HttpContext.Response.Cookies.Append(cook.Key, cook.Value, cop);
     }
 }

}
return new RedirectResult(url: “https://impact.oneseed.eco” + (req.Path.HasValue ? req.Path : “”) + (req.QueryString.HasValue ? req.QueryString : “”),
permanent: true, preserveMethod: false);