nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
955 stars 198 forks source link

fix: per-client `tokenName` from config files #403

Open sgarner opened 3 years ago

sgarner commented 3 years ago

Fixes #386

When defining multiple apollo clients in external files, the tokenName for each client would not be set correctly in the compiled plugin.

This PR changes the template so that the tokenName is read after reading the config file instead of before.

sgarner commented 3 years ago

Note that an issue remains with the implementation of onLogin in $apolloHelpers, which always sets cookies using the default AUTH_TOKEN_NAME regardless of which client is in use.

I don't see an obvious solution to that since there is no way to relate the passed in client object back to a configured client name to determine which token to use.

Ideas for that welcome, but this PR at least fixes the issue with the wrong token being sent in requests.

sgarner commented 3 years ago

BTW the failing build has nothing to do with this PR and looks like it has been broken for a while 😬