DEV Community

Discussion on: GraphQL (microservices) architecture by Apollo

Collapse
 
usman174 profile image
Muhmmad Usman • Edited

I have some questions about user authentication with apollo client 3 since all youtube videos are outdated there isnt much usefull,In the backend, I am using sessions with redis and storing the session in the cookie and now I have no idea how to work with this approach with apollo client 3 .I am stuck at setting the context how to get cookie from the server and blah blah blah and there is no post regarding this approach.Could make an authentication post?

Collapse
 
mucorolle profile image
Muco Rolle Tresor

If you did not solve this problem here's the solution, to make apollo client pass the cookie to the server in every request you need to add credentials: "include" property in your ApolloClient instance

new ApolloClient({
        uri: API_URL,
        credentials: 'include',
        cache: new InMemoryCache(),
    });
Enter fullscreen mode Exit fullscreen mode