All,
Is it possible to read cookies in an LWC component? (I think it is possible through Visualforce pages, but I need to do this in an LWC component)
According to the documentation, I should get all the cookies when i fire this command:
Cookie ck= ApexPages.currentPage().getCookies().get('cookie_name');
But, I always get a null value when I do
ApexPages.currentPage()
Edited: This component will be present on the main community login page. Here is the class:
public with sharing class CookieSync {
public CookieSync() {
}
@AuraEnabled
public static String customSync(){
System.debug('checkpoint1');
system.debug(ApexPages.currentPage()); //returns null
// logic omitted.
return 'test';
}
}