I have backend API based on Express.js and clientside based on React-Redux.
Authentification to my API is done by Express.js sessions. User log-in by Passport (OAuth2) and after that user's cookie is saved to database connected with his user-id. This cookie is also in client browsers's cookie storage.
If you send next request to this API, server checks your cookie with database and if its correct it answer you data.
It was working well when I was not using React, but now clientside must somehow know that user is logged even before u make some request (when React app is loaded).
Session cookie is saved even when user is not logged, so I am lost.
How to do it?
Image about how it works: https://i.stack.imgur.com/6g0ei.png
ADDITIONAL RESEARCH:
I was investigating https://www.instagram.com/ for example... They using session cookie... If I delete this cookie, user is logouted, also when I use this cookie in Postman, I can fetch API. But I can't find any request what checking if user is logged. React App just know it right after initial data from server are recieved. Maybe they pushing this information into React from server? Not by calling APi after loading app?