I am currently developing a Chrome extension that includes login and logout features. After a successful login, the server sends a token that I need to store in a cookie. The process looks like this:
function success(response) {
if(response.data && response.data.token) {
$cookies.putObject('depassify_auth', response.data);
$rootScope.auth.token = $cookies.getObject('depassify_auth');
$state.go("generate");
}
}
Everything works smoothly during the login process as the cookie object is set and saved correctly. However, when it comes to logging out, I encounter an issue with removing the cookie.
vm.logout = function () {
$cookies.remove('depasify_auth');
delete $rootScope.auth.token;
vm.goto("home");
}
Even after debugging with a breakpoint in the logout
function and manually trying to call
$cookies.remove('depassify_auth')
, the cookie still persists. I suspect that the cookie might be stored on a different domain than the one I am attempting to delete it from. Is there any way to determine the domain where the cookie is set? I have checked the devtools and Chrome settings but cannot find the cookie anywhere.
Any insights or suggestions would be greatly appreciated. Thank you.