Score:0

Clicking a Google query link logs user out of session

jp flag

I have a curious situation with my NodeJS server: it seems like searching for the website on Google signs out the user.

The homepage is https://emocoes.org/pt/inicio. I sign in to the website and the homepage shows the version for users, such as a "Content list" button.

I open a new tab, search for the website on Google and click the link. Now the homepage no longer shows the version for users. It's as if I had signed out. When I refresh the first tab with the member version of the homepage, it also shows the public version. I checked that the cookie for session in the session store still exists.

The URL from the Google query is:

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwjC2J3D65H4AhX5Q_EDHRpnCvoQFnoECAYQAQ&url=https%3A%2F%2Femocoes.org%2Fpt%2Finicio&usg=AOvVaw15-Ef1H79pA6DxaHMLJfgC

I do not see any issue in this link.

I added this tracing to the server's route for the homepage:

router.get("/pt/inicio", async (req, res) => {
  console.log("URL = %o", req.originalUrl);
  console.log("query = %o", req.query);
  console.log("User = %o", req.user);
  // The result after the Google URL is:
  //[2022-06-03T17:40:21.308Z] URL = '/pt/inicio'
  //[2022-06-03T17:40:21.308Z] query = {}
  //[2022-06-03T17:40:21.309Z] User = undefined
  ...
});

Since the session exists in the MongoDB store, it's as if clicking the Google link deletes the cookie in the browser. I have Safari on macOS but the same thing happens to another user on Windows and Google Chrome.

How can I debug this issue?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.