WkWebView cookies setup issue

I am using the MSAL library for authentication, and after successful authentication, I am setting cookies for the WKWebView to run the application. However, it does not work.
I am using following code snippet for cookies setup :

DispatchQueue.main.async {
                var tokenCookieProperty: [HTTPCookiePropertyKey: Any] = [
                            HTTPCookiePropertyKey.domain: "*",
                            HTTPCookiePropertyKey.path: "/",
                            HTTPCookiePropertyKey.name: "cookieName",
                            HTTPCookiePropertyKey.value: result.session,
                            HTTPCookiePropertyKey.secure : "Yes" as String]

                let session: HTTPCookie! = HTTPCookie(properties: tokenCookieProperty)
                guard let bridgeWebController = self.bridge?.webView else {
                    print("Unable to get Capacitor bridge wkwebview")
                HTTPCookieStorage.shared.removeCookies(since: Date(timeIntervalSince1970: 0))

The key is to not use cookies :upside_down_face: See this post - Capacitor iOS / Cookie Authentication / capacitor/http - #10 by dallas

If you have to use cookies, why not use the Capacitor Cookie plugin?