Questions tagged [cookies]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
68 views

Create cookie after download file

I want to create a cookie after a file download. This is an extension on the existing module: https://www.drupal.org/project/file_utility Each time you click on a download, a popup opens. For me it ...
0
votes
1answer
22 views

How can I change the 'type' of Drupal script tags from text/javascript to text/plain?

I could use some assistance in figuring out a way to change script tags for a Drupal 7 site to be "text/plain" instead of "text/javascript" And additional attribute(s). I can tell already that ...
1
vote
1answer
148 views

Cookie Compliance and Google Analytics

I'm using Drupal 8.6.14 (going to upgrade soon) and I am trying to create a cookie consent page that actually works! I've used many different modules like EU Cookie Compliance, GDPR Compliance and ...
2
votes
0answers
244 views

Set SameSite=strict for session cookies

I'm trying to figure out how to set the SameSite cookie attribute for Drupal 8 session cookies, but I can't find a solution. I thought SessionConfiguration might give me enough options, but it seems ...
0
votes
0answers
58 views

cant read current user in middleware

i am relatively new to drupal . thus i am trying to make an sso system work . i have this parent domain "domain.com" and the drupal site is running on sub.domain.com  . i can read the cookies and all ....
0
votes
0answers
20 views

How to remove cookies created by Getresponse iframe before user give his consent?

I have a drupal 8 website with Getresponse integration which provide a form in an iframe. This module create some cookies, which i need to hide before user give his consent. Tried with block hook, but ...
0
votes
1answer
55 views

Cookie sharing on multidomain site [closed]

Can somebody please clarify, that cookie sharing in Drupal 8 is just possible for sub domains siblings of the same parent domain. Before this was discussed here: Multi-domain cookie - unfortunately ...
0
votes
0answers
17 views

Set and retrieve cookie in a form [duplicate]

How do you set and retrieve a cookie from a custom form in Drupal 7? I am trying to set and retrieve a cookie containing form_state in a custom form. The form is a multi-step form. My intention is to ...
0
votes
0answers
29 views

Check for cookie value(s) for a visitor and attempt to authenticate them?

I have a case where when a visitor comes to the site from a subsite (different application), if they are authenticated (there will be a cookie value), I need to get this cookie value and initiate a ...
0
votes
1answer
250 views

How do I dynamically change cookie_lifetime?

I'm trying to change cookie_lifetime dynamically in my D8 project, to set cookie_lifetime to 0 or to some value(for example 24 hours). I know that this can be partially acomplished by changing ...
2
votes
1answer
1k views

How do I set a cookie using $response->headers->setCookie() in a form submission handler?

I read on Deprecate user_cookie_save() and user_cookie_delete(). that user_cookie_save() will be deprecated in Drupal 9 and that we should now use the Symfony's method, as in the following code. $...
0
votes
0answers
884 views

How to use cookies in Twig?

I'm trying to create a conditional twig function in a template I created for my website's home page (page--front.html.twig). Twig can supposedly do this out of the box, but I can't get this approach ...
0
votes
1answer
514 views

SSESS Cookie (Session ID) is being changed when loading images that don't exist

I have a Drupal 8.6.10 site which has a very confusing logout bug: I have a page that has various elements on it as images, js, css and so on. I load that page and everything works fine I add an ...
5
votes
2answers
737 views

Can't find cookie for validation in EventSubscriber

There's this module Splash Redirect in which src/EventSubscriber/SplashRedirectEventSubscriber.php is supposed to check if the cookie $config_cookie exists or not, if it already exists then the user ...
0
votes
0answers
81 views

Performance Considerations When Setting the Cookie Expiration Date

Are there any performance considerations to take into account when setting a Drupal cookie to expire 10 or 20 years in the future? I know it's not possible to set a cookie to never expire as per the ...
0
votes
1answer
273 views

Drupal EU Cookie Compliance module conflict with theme JQuery

When I first installed the module, it'd only appear in admin pages. After some investigation, I discovered the cause was some sort of conflict with my themes jquery: jquery-1.11.2.min.js. If I ...
0
votes
1answer
424 views

Is it possible to remove the leading dot from the cookie domain?

I want to remove the leading dot from the cookie domain name. Is there any way to do this in Drupal 8?
3
votes
0answers
571 views

How to add 'Set-cookie' header on rest POST response

I have subdomain front.test.local as frontend ngx-app and another subdomain back.test.local for the backend pure Drupal both on https - cookie-domain is set to '.test.local'. I need cookie because ...
2
votes
1answer
4k views

How to correctly use cookies? (Twig and cache context)

In my current project I need to alter node templates depending on previously visited landing page. My idea is that, when a visitor visits one of these landing pages, a cookie will be set, and ...
5
votes
1answer
1k views

What is the difference between a Drupal session variable and a cookie?

When you set a Drupal session variable (i.e. a "magic" variable you may set like this): $_SESSION['mymodule'] = array('key' => 'value'); the value goes away when the user logs out. If you set a ...
0
votes
1answer
2k views

Rest login cookie token explanation

When logging in via a POST to user/login?_format=json I'm sent back a response that looks like this { "current_user": { "uid": "233", "name": "test" }, "csrf_token": "...
1
vote
2answers
441 views

How to provide the “Privacy policy link” correctly on EU COOKIE COMPLIANCE module?

After this recent update of the module, when I run a Status Report, it warns me that: “Privacy policy link not provided”, but I actually think I did it by filling up the field “Privacy policy link”, ...
0
votes
1answer
41 views

Clearing Cookies

I have a website and I have configured it such that only once the user accepts the use of cookies on their website, cookies will be enabled. I tried using javascript to delete all cookies on page ...
0
votes
1answer
93 views

CAS module - disabling auto login / want nonpersistent cookies - deleted when browser closes

Our security team says we need to modify the cas module so that it either deletes the session cookies when the browser closes or use a session variable rather than a cookie. I can't figure out how to ...
3
votes
2answers
561 views

Invalidate Internal Page Cache on cookie change

I need to invalidate the Internal Page Cache for anonymous users when the value of a specific cookie changes. How can I implement this? I'm tried to add: $build['#cache']['contexts'][] = 'cookies:my-...
0
votes
3answers
252 views

Subdomain drupal sites cannot read domain cookies

I have set a cookie from domain (.example.co) and its .NET platform & reading those cookie from drupal site(test.example.co). While retrieving it shows empty, I have used $_COOKIE. This link ...
0
votes
1answer
156 views

Why doesn't the view read cookies on AJAX refreshment?

I use views_extras module to get default argument froom cookies. It works ok. But if I set a cookie value using javascript and then refresh a view using ajax the view still shows result for previous ...
0
votes
1answer
302 views

Keep getting “Bad request” messages in browser after adding JS

I have added this script in my Drupal 7 site to make the site remember the last clicked Quicktab and then open that tab on page reload: // JavaScript Document (function($) { Drupal.behaviors....
0
votes
1answer
275 views

Authentication cookie in a load balanced environment

Hopefully this is a basic question. I'm going to be setting up a drupal website there there will be multiple servers in back of a load balancer. The user will hit one web server where they will ...
5
votes
2answers
2k views

Increase session timeout

So I have a requirement that I'm getting close to stumped on how to complete in Drupal 8. I'm going to attempt to simplify the requirements. I have two roles. They are essentially mutually exclusive. ...
1
vote
1answer
481 views

WSOD when redirecting based on cookie

I have a site where I set a cookie when the user is visiting a specific content-type: function THEME_preprocess_node(&$variables) { if (isset($variables['node']) && $variables['node']-&...
0
votes
1answer
827 views

How to clear cookie with cookie name on from submit?

When users fill values in node form input fields I set cookies of those values with help of javascript code, example : var date = new Date(); date.setTime(date.getTime() + (60 * 60 * 1000)); ...
0
votes
1answer
43 views

Force a session to become HTTPS?

I'm working with a very complex legacy D7 site, and very complex requirements (bleaugh). Anyway: I'm working on a deeplinking system that allows a jump to the site, which then logs-in a user (this is ...
0
votes
0answers
533 views

Logout on browser close not working

I need to log out a user on browser close. I did following things but it's not working. Copy default.services.yml to services.yml in the same directory and change the cookie_lifetime value 2000000 to ...
2
votes
1answer
6k views

Multi-domain cookie

The website I'm working on has 5 domains (two top level and 3 subs, not including www). I need to limit the cookie that the site creates to only work on 4 of the domains. I have found from here that ...
0
votes
2answers
165 views

Can cookies safely be stored in the public filesystem (sites/default/files)?

One of my modules does some CURLing, and to do this it creates a cookie on the Drupal server. Where should I locate this? Where it will be nice and safe? Is there a convention? Is sites/default/files ...
4
votes
2answers
6k views

Headless Drupal 8 - cookie authentication

Disclaimer: not an experienced Drupal dev here, just a junior dev trying to get things done smoothly. Please excuse naive claims or questions. I am successfully using a headless Drupal 8 setup that I ...
0
votes
1answer
60 views

How to highlight new added links on front page with cookies?

My front page contains say 3 different views and each view has 10 rows. My requirement is Links which were not published to the frontpage the last time the user loaded it should be highlighted. I am ...
6
votes
1answer
6k views

How to setup cookie domain?

I am trying to set $cookie_domain in my settings.php within Drupal 8. In Drupal 7, I add this in settings.php to set it up, but I am not sure how to do it in Drupal 8: $cookie_domain = ".domain....
2
votes
1answer
37 views

Drupal 7 sessions wiped after changing settings.php

Yesterday afternoon I had an administrator uncomment and modify the $base_url variable in our production environment. Any changes made in the repository fires off a redeployment which has never been ...
5
votes
0answers
4k views

What cookies does Drupal use? [closed]

I need help with this.. A client wants to write a privacy policy for their site and they are asking what cookies Drupal uses so that they can include a description of them in the policy. Which cookies ...
5
votes
1answer
1k views

How does drupal set user cookie

The following code, let's login any user programmatically. global $user; $user = user_load(<any_uid>); My question is how does the above code triggers to set new user cookies on browser, at ...
6
votes
1answer
846 views

Authenticate using OAuth

I'm working on wrapping my mind around decoupled Drupal 8 while using an AngularJS app for the frontend. What I am trying to do is to allow a user to authenticate with my D8 site using their username ...
1
vote
1answer
3k views

How do I delete cookies when users log out?

How do I delete cookies when users log out? How can I do this with out modifying any core module?
1
vote
0answers
84 views

EU Compliance for Drupal multidomain (each domain has its own language)

We have developed a multidomain drupal project and each domain has its own language. In other words, each language has assigned its own domain. When we have developed multilanguage sites we have not ...
0
votes
0answers
329 views

Unable to read cookies in page.tpl.php

I am trying to execute the following in page.tpl.php. setcookie('front_page_survey','yes', time() + (86400 * 365), "/"); echo $_COOKIE['front_page_survey'] .'cookie' ; setcookie() works as ...
1
vote
1answer
133 views

Services api set browser cookie

I would like to use Services to programmatically login a user from another website. So for example if site.example.com uses the services login endpoint on example.com in Chrome, when that user moves ...
3
votes
3answers
3k views

Users can't log in sometimes

Drupal 7.5, PHP 5.6.27 Debian 8, remote host. We are running into a problem where some people can't log in some of the time and sometimes it works if they try multiple times. Users have reported the ...
0
votes
0answers
543 views

How to selectively disable cookies?

We have a drupal 7 instances and were wondering how it would be possible to conditionally disable certain cookies for site visitors? We are trying to make sure we are EU cookie compliant. We are ...
1
vote
1answer
50 views

how to remember results of a views query in rules

I have a site with an eva view that is embedded into a view page that is directly accessible, running the query for the first time. To that I have added rules_views, I want to e-mail out certain ...