function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
James GeorgeJames George 

Enhanced domain third party cookie issue

Hi All,
Anybody facing issue with the new Enhanced domain implementation, I am not able to get the handle to the cookies.

Any help will be much appreciated.

Below is my scenerio/steps
1. salesforce sets the cookie value using an LWC component.
2. Re-directs the page to OKTA for authentication.
3. OKTA after authentication re-directs to a visual force page where the Javascript tried to read the cookie already set in the step 1.
The value reading the while reading the cookie is 'undefined'

It's all working well without Enhanced domain implementation enabled, As Jan 10 2023 is the cutoff date of mandatory implementation of Enhanced Domain on Sandboxes, we are trying to resolve this issue before the cut-off date.


 
function getCookie(name) {
            let cookieString = "; " + document.cookie;
            let cookies = cookieString.split("; ");
            let currentCookieVal;
            cookies.forEach(cookie => {
            let currentCookieArr = cookie.split('=__');
                if(currentCookieArr.length && currentCookieArr.length === 2) {
                    if(currentCookieArr[0].includes(name)) {
                        currentCookieVal = currentCookieArr;
                    }
                }
            });
            return currentCookieVal;
        }

Thanks,
James
Leo BishopLeo Bishop

Enhanced domains comply with the latest browser requirements. Specifically, they avoid third-party cookies, otherwise known as cross-site resources.


Myhdfs Login (https://www.myhdfs.net/)
 

James GeorgeJames George

Hi All,
I resolved the issue by doing the following.
1. Modified the javascript code in the existing vf page
2. Placed all the js code which calling the third party cookie from a newly created LWC component's javascript as there is no problem of LWC component to reach out to third party cookie.

The issue is resolved.

Thanks,
James