Cookiebot - refusing cookies prevented HttpClient from running the subscribe method callback

336 Views Asked by At

Our client is using cookiebot on their sites and we faced an issue that is happening when the user chooses "Only Necessary" cookies. This problem occurs only when the "Only Necessary" option is selected, and is not happening if all cookies are accepted.

We have noticed that after "Only Necessary" cookies are accepted, the subscribe on Angular HttpClient get(), post() and other methods is never executed. This problem is solved if the page is reloaded.

Here is a code example:

this.http.get<string[]>('some/api/users', httpOptions)
.subscribe(res => {
  // It never gets here
  this.users = res;
});

I have created a simple PoC application that is demonstrating this behavior, which can be accessed here: https://cookiebot-poc.herokuapp.com/mobapp/

Working scenario:

  1. Clean cookies (or open incognito)
  2. Open https://cookiebot-poc.herokuapp.com/mobapp/
  3. Accept "all" cookies
  4. Click "Do Get" or "Do Post" button
  5. Request is sent, and list with users are displayed on screen

Issue reproduction scenario:

  1. Clean cookies (or open incognito)
  2. Open https://cookiebot-poc.herokuapp.com/mobapp/
  3. Accept "Necessary" cookies only
  4. Click "Do Get" or "Do Post" button
  5. Nothing happens

What is going wrong here?

0

There are 0 best solutions below