apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Apollo tokenName is always the same

Open LuXDAmore opened this issue 4 years ago • 1 comments

Version

v4.0.1-rc.1

Reproduction link

https://codesandbox.io/s/nuxt-apollo-module-token-name-bug-ym7pn

Steps to reproduce

  1. Create a Nuxt project;
  2. Install the module;
  3. Configure 2 different clients;
  4. Use a custom tokenName value per-client.

What is expected ?

It should create differents cookies per-clients.

What is actually happening?

Create only one cookie used by all the clients, with the name 'apollo-token'.

Additional comments?

The version i'm using is the 4.0.1-rc.5, but it's not present in the list.

From the generated file .nuxt/apollo-module.js:

  
  const AUTH_TOKEN_NAME = 'apollo-token';
  const defaultTokenName = ''  || AUTH_TOKEN_NAME;
  const authTokenName = ''  || AUTH_TOKEN_NAME;

  cookies.set( AUTH_TOKEN_NAME, token, cookieAttributes );
  cookies.remove( AUTH_TOKEN_NAME, cookieAttributes );

Every cookie / name is based on the default value and not from the provided tokenName per-client.

This bug report is available on Nuxt community (#c371)

LuXDAmore avatar Mar 16 '21 15:03 LuXDAmore

I am seeing the same issue.

PR: https://github.com/nuxt-community/apollo-module/pull/403

sgarner avatar Jun 30 '21 05:06 sgarner