Answer the question
In order to leave comments, you need to log in
How to specify authorization token in react apollo?
How to pass the Bearer token authorization header in this case?
const wsLink = new WebSocketLink({
uri: 'wss://domen/v1/graphql',
options: {
reconnect: true
}
})
const httpLink = new HttpLink({
uri: 'https://domen/v1/graphql',
})
const client = new ApolloClient({
link: split(
({ query }) => {
const { kind, operation } = getMainDefinition(query)
return (
kind === 'OperationDefinition' &&
operation === 'subscription'
)
},
wsLink,
httpLink,
),
cache: new InMemoryCache()
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question