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:
- Clean cookies (or open incognito)
- Open https://cookiebot-poc.herokuapp.com/mobapp/
- Accept "all" cookies
- Click "Do Get" or "Do Post" button
- Request is sent, and list with users are displayed on screen
Issue reproduction scenario:
- Clean cookies (or open incognito)
- Open https://cookiebot-poc.herokuapp.com/mobapp/
- Accept "Necessary" cookies only
- Click "Do Get" or "Do Post" button
- Nothing happens
What is going wrong here?