Skip to content
This repository has been archived by the owner on Jul 12, 2019. It is now read-only.

Authorization Header gives error #14

Open
tspanu opened this issue Apr 7, 2019 · 0 comments
Open

Authorization Header gives error #14

tspanu opened this issue Apr 7, 2019 · 0 comments

Comments

@tspanu
Copy link

tspanu commented Apr 7, 2019

The current implementation of auth-link gives the following error because it expects a token:

extensions: {path: "$", code: "invalid-headers"}
message: "Malformed Authorization header"

It needs to be update to the following so we only add the authorization if there is a token:

const authLink = setContext((_, { headers }) => {
    if (token) {
        return {
            headers: {
                ...headers,
                Authorization: `Bearer ${token}`
            }
        }
    }

    return headers
})
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant