use Session cookies with adonis & react

Viewed 32

I'm having trouble understanding how session cookies work. I have an Adonisjs Api and a React app. In my login / Register components, I fetch the data with post request and credentials set to true. Everything work fine and the adonis-session cookie is set in the browser. But, after that, I want to be redirected to the homepage and fetch users' posts but I get 401 unauthorized response.

Can someone help me understand what I need to do? How can I check if the user is logged in with this adonis-session token? Use the context API?

0 Answers
Related