In my Nuxt app I have auth token stored in my cookie named 'auth._token.auth0'. It looks like:
Bearer%20eyJhbGciO...
And I want to use this token in my apollo requests authorization header, so I configured my apollo module:
apollo: {
clientConfigs: {
default: {
httpEndpoint: process.env.GRAPHQL_ENDPOINT,
httpLinkOptions: {
credentials: 'same-origin'
},
tokenName: 'auth._token.auth0'
}
}
},
and it successfully attaches token from cookie to apollo authorization header, but it adds another 'Bearer ' string, so graphql returns Malformed Authorization header error, because authorization header looks like:
authorization: Bearer Bearer eyJhbGciOi...
Any ideas how to solve this issue in nuxt apollo module or nuxt auth module?
I fixed it by adding authenticationType: ''
in config:
apollo: {
clientConfigs: {
default: {
httpEndpoint: process.env.GRAPHQL_ENDPOINT,
httpLinkOptions: {
credentials: 'same-origin'
},
tokenName: 'auth._token.auth0'
}
},
authenticationType: ''
},