NextAuth / Redux - How am I suppose to handle the Authentication flow?
Unanswered
Bouvier des Ardennes posted this in #help-forum
Bouvier des ArdennesOP
Hello all, i'm trying to build an app with NextAuth/Redux/RTK... But I struggle to understand how I should store the data after a login.
I made a repo for this : https://gitlab.com/hyakki/nextauth/-/tree/main/apps/web?ref_type=heads
What I have now :
- Routes protected with NextAuth.
- Authentication flow working. The login verifies the user by fetching to an API (directus)
- RTK query to retrieve a PostType (Collections)
What I have not:
- I hardcoded the access_token which should be added to the headers of each queries of the app.
What I dont undestand:
- How am I suppose to store the user data to be accessible everywhere in my app, after the user successfully logged in.
I made a repo for this : https://gitlab.com/hyakki/nextauth/-/tree/main/apps/web?ref_type=heads
What I have now :
- Routes protected with NextAuth.
- Authentication flow working. The login verifies the user by fetching to an API (directus)
- RTK query to retrieve a PostType (Collections)
What I have not:
- I hardcoded the access_token which should be added to the headers of each queries of the app.
What I dont undestand:
- How am I suppose to store the user data to be accessible everywhere in my app, after the user successfully logged in.