For an application, I need to remove two server-side generated cookies if the User has selected to not allow cookies. I can detect the cookies, get the consent settings, and everything just fine. However, when I try to remove the existing cookies they do not delete. What I have come across is that calling cookies[:cookie_name].delete should work, and if there is a domain added when it is created I must include that. However when I include that like this:
cookies.delete :cookie_name, domain: 'www.domain_set_on_cookie.com'
I get an error that there are 2 arguments being sent when there should only be one. Just removing the domain part does not remove the cookie either, although there is no error thrown. The cookie is set like this:
cookies[:cookie_name] = {
value: SecureRandom.uuid,
expires: 20.years.from_now,
domain: 'www.domain_set_on_cookie.com',
httponly: true
}
The value of the cookie would be something like this:
6o2843rowdf5-20ce-4d0b-azzf-49b91Zccnd771d7
IF anyone can see what I am missing here in order to get this cookie to go away and make a suggestion it would be much appreciated, thanks!