Use setContext with Apollo Client 3.0
See original GitHub issueIntended outcome: using Bearer Authentication, thus having looked up in the docs how to do it: https://www.apollographql.com/docs/react/v3.0-beta/networking/authentication/#header
Actual outcome:
https://www.apollographql.com/docs/react/v3.0-beta/networking/authentication/#header
In the code example, setContext
is used, but it isn’t shown where it is imported from.
I can find references in the web, that one should import it from apollo-link-context
, but I am not sure whether this is still the way to go with v3.0.
Anyways, I think in the docs it should be methioned where to import it from 😊
How to reproduce the issue: Try to follow the docs
Versions System: OS: macOS 10.15.3 Binaries: Node: 10.19.0 - ~/.nvm/versions/node/v10.19.0/bin/node Yarn: 1.22.4 - ~/.nvm/versions/node/v10.19.0/bin/yarn npm: 6.13.4 - ~/.nvm/versions/node/v10.19.0/bin/npm Browsers: Chrome: 80.0.3987.149 Firefox: 74.0 Safari: 13.0.5 npmPackages: @apollo/client: ^3.0.0-beta.41 => 3.0.0-beta.41 @apollo/link-ws: ^2.0.0-beta.3 => 2.0.0-beta.3
Thank you so much in advance for your time!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (1 by maintainers)
Top GitHub Comments
@hannojg use this:
import { setContext } from '@apollo/client/link/context';
https://www.apollographql.com/docs/react/networking/authentication/#header
Most of the
apollo-link-*
packages are now under@apollo/link-*
namespace.I agree that this is poorly documented so far.