New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: fix: set apollo-token cookie in SSR #358
base: v4
Are you sure you want to change the base?
Conversation
Prior to this, the used cookie library only supports setting cookies in SSR, if it is explicitly called in a middleware. So instead of doing this manually, usage of cookie-universal-nuxt is introduced. It is assumed to be present in the nuxt context.
any updates here? |
I'm waiting for feedback on the introduction of the |
no more maintainers? |
Hello, pls fix this somehow :( Or is there a workaround being used? Like what's the point of Nuxt when I can't even server render user dependent content based on session cookie |
I tried, but in nuxt console i get: |
Does this mean Apollo doesn't work for SSR apps that require auth? I'm unable to send cookies while in SSR mode. |
@hauptbenutzer any idea how to implement cookie-universal-nuxt with a custom apolloConfiguration with a setContext or httpLink? I tried sending nuxtjs 2.16.0
const ssrMiddleware = setContext((_, { headers }) => ({
headers: {
...headers,
Accept: 'application/json',
'Content-type': 'application/json',
'X-Brand': 'some-brand',
'X-XSRF-TOKEN': decodeURIComponent($cookies.get('XSRF-TOKEN')),
},
}));
const httpLink = new HttpLink({
uri: `${$config.apiUrl}/graphql`,
credentials: 'include'
});
const link = from([ssrMiddleware, httpLink]); |
This fixes #312.
This PR's description and its content are WIP. We need to figure out whether we want the implicit dependency on
cookie-universal-nuxt
or if there's a different solution.Prior to this, the used cookie library only supports setting cookies in SSR, if it is explicitly called in a middleware. So instead of doing this manually, usage of cookie-universal-nuxt is introduced. It is assumed to be present in the nuxt context.